Documentation ¶
Index ¶
- Variables
- func Debug(v ...any)
- func Debugf(s string, v ...any)
- func Error(v ...any)
- func Errorf(s string, v ...any)
- func Fatal(v ...any)
- func Fatalf(s string, v ...any)
- func Info(v ...any)
- func Infof(s string, v ...any)
- func Init(c *Config)
- func ParseFlags(flags string) int
- func Trace(v ...any)
- func Tracef(s string, v ...any)
- func Warn(v ...any)
- func Warnf(s string, v ...any)
- type Backend
- func (x Backend) Clone() Logger
- func (x Backend) Debug(v ...any)
- func (x Backend) Debugf(f string, v ...any)
- func (x Backend) Error(v ...any)
- func (x Backend) Errorf(f string, v ...any)
- func (x Backend) Fatal(v ...any)
- func (x Backend) Fatalf(f string, v ...any)
- func (x Backend) Info(v ...any)
- func (x Backend) Infof(f string, v ...any)
- func (x *Backend) IsColor() bool
- func (x Backend) Level() Level
- func (x Backend) Logger() *stdlog.Logger
- func (x Backend) NewLogger(subsystem string) Logger
- func (x Backend) NewWriter(l Level) io.Writer
- func (x Backend) Noop(...any)
- func (x *Backend) SetLevel(l Level) Logger
- func (x *Backend) SetLevelString(s string) Logger
- func (x Backend) Trace(v ...any)
- func (x Backend) Tracef(f string, v ...any)
- func (x Backend) Warn(v ...any)
- func (x Backend) Warnf(f string, v ...any)
- func (x *Backend) WithColor(b bool) Logger
- func (x *Backend) WithFlags(f int) Logger
- func (x *Backend) WithLogger(l *stdlog.Logger) Logger
- func (x *Backend) WithSampler(s *Sampler) Logger
- func (x *Backend) WithTag(tag string) Logger
- func (x Backend) Write(p []byte) (n int, err error)
- type Config
- type Level
- type LogFn
- type LogfFn
- type Logger
- type ProgressLogger
- type Sampler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ColorTrace = color.FgHiBlue ColorDebug = color.FgCyan ColorInfo = color.FgGreen ColorWarn = color.FgYellow ColorError = color.FgRed ColorFatal = color.FgMagenta )
View Source
var ( // Often samples log 10 events per second. SampleMany = &Sampler{N: 10, Period: time.Second} // Sometimes samples log 1 event per second. SampleSome = &Sampler{N: 1, Period: time.Second} // Rarely samples log 1 events per minute. SampleFew = &Sampler{N: 1, Period: time.Minute} )
View Source
var Noop = func(string, ...any) {}
Functions ¶
func ParseFlags ¶
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
func (*Backend) SetLevelString ¶
func (*Backend) WithSampler ¶
type Config ¶
type Config struct { Level Level `json:"level"` Flags int `json:"flags"` Backend string `json:"backend"` Addr string `json:"addr"` Facility string `json:"facility"` Ident string `json:"ident"` Filename string `json:"filename"` FileMode os.FileMode `json:"filemode"` ProgressInterval time.Duration `json:"progress"` NoColor bool `json:"nocolor"` }
type Level ¶
type Level byte
func ParseLevel ¶
func (Level) MarshalText ¶
func (*Level) UnmarshalText ¶
type Logger ¶
type Logger interface { Noop(...any) Trace(v ...any) Tracef(f string, v ...any) Debug(v ...any) Debugf(f string, v ...any) Info(v ...any) Infof(f string, v ...any) Warn(v ...any) Warnf(f string, v ...any) Error(v ...any) Errorf(f string, v ...any) Fatal(v ...any) Fatalf(f string, v ...any) Level() Level IsColor() bool SetLevel(Level) Logger SetLevelString(string) Logger Logger() *stdlog.Logger Clone() Logger WithTag(tag string) Logger WithSampler(s *Sampler) Logger WithColor(b bool) Logger WithFlags(f int) Logger WithLogger(l *stdlog.Logger) Logger }
func SetLevelString ¶
type ProgressLogger ¶
func NewProgressLogger ¶
func NewProgressLogger(logger Logger) *ProgressLogger
func (*ProgressLogger) Flush ¶
func (p *ProgressLogger) Flush()
func (*ProgressLogger) Log ¶
func (p *ProgressLogger) Log(n int, extra ...string)
func (*ProgressLogger) SetAction ¶
func (l *ProgressLogger) SetAction(action string) *ProgressLogger
func (*ProgressLogger) SetEvent ¶
func (l *ProgressLogger) SetEvent(event string) *ProgressLogger
func (*ProgressLogger) SetInterval ¶
func (l *ProgressLogger) SetInterval(interval time.Duration) *ProgressLogger
Click to show internal directories.
Click to hide internal directories.