helper

package
v2.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const FormatterKey = "formatter"
View Source
const LogLevelStringDefaultValue = "ERROR"

Variables

View Source
var DebugLoggerOut io.Writer
View Source
var ErrorLoggerOut io.Writer
View Source
var InfoLoggerOut io.Writer
View Source
var NextColor = rainbowColor

Functions

func CreateThreshold

func CreateThreshold(d time.Duration) <-chan time.Time

func FilterError added in v2.2.6

func FilterError(cmds []*exec.Cmd, err error) ([]*exec.Cmd, error)

func IsDir

func IsDir(path string) bool

func IsExist

func IsExist(path string) bool

func IsNotExist

func IsNotExist(path string) bool

func SetupForOs added in v2.7.0

func SetupForOs(cmd *exec.Cmd)

Types

type ColorFunc added in v2.9.0

type ColorFunc func(s string) string

ColorFunc use ANSI codes to render colored text on console

var DebugLoggerColorFunc ColorFunc
var ErrorLoggerColorFunc ColorFunc
var InfoLoggerColorFunc ColorFunc

type EmptyCmdError

type EmptyCmdError error

func NewEmptyCmdError

func NewEmptyCmdError() EmptyCmdError

type Formatter added in v2.9.0

type Formatter struct {
	// contains filtered or unexported fields
}

func NewFormatter added in v2.9.0

func NewFormatter(prefix string, colorF ColorFunc, w io.Writer) *Formatter

func (Formatter) Write added in v2.9.0

func (f Formatter) Write(p []byte) (n int, err error)

type LogLevel

type LogLevel uint
const (
	ERROR LogLevel = iota
	INFO
	DEBUG
)

type LogLevelString

type LogLevelString string

func (LogLevelString) GetLogLevel

func (l LogLevelString) GetLogLevel() LogLevel

type Logger added in v2.6.0

type Logger interface {
	Debug(string)
	Info(string)
	Error(string)
}
var GlobalLogger Logger

func NewBasicLogger

func NewBasicLogger(logLevel LogLevel) Logger

type WatcherContext added in v2.7.0

type WatcherContext struct {
	// contains filtered or unexported fields
}

func NewWatcherContext added in v2.7.0

func NewWatcherContext(prefix string) *WatcherContext

func (*WatcherContext) ApplyGracefulShutdown added in v2.7.0

func (w *WatcherContext) ApplyGracefulShutdown(cmds []*exec.Cmd)

func (*WatcherContext) CancelAndNew added in v2.7.0

func (w *WatcherContext) CancelAndNew()

func (*WatcherContext) Context added in v2.7.0

func (w *WatcherContext) Context() context.Context

func (*WatcherContext) MarkStart added in v2.7.0

func (w *WatcherContext) MarkStart()

func (*WatcherContext) SetWaitNumber added in v2.7.0

func (w *WatcherContext) SetWaitNumber(num int)

func (*WatcherContext) WaitStart added in v2.7.0

func (w *WatcherContext) WaitStart()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL