Documentation
¶
Index ¶
- Variables
- func Debug(v ...interface{})
- func Debugf(s string, v ...interface{})
- func Error(v ...interface{})
- func Errorf(s string, v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(s string, v ...interface{})
- func Info(v ...interface{})
- func Infof(s string, v ...interface{})
- func Init(config *Config)
- func ParseFlags(flags string) int
- func Trace(v ...interface{})
- func Tracef(s string, v ...interface{})
- func Warn(v ...interface{})
- func Warnf(s string, v ...interface{})
- type Backend
- func (x Backend) Clone() Logger
- func (x Backend) Debug(v ...interface{})
- func (x Backend) Debugf(f string, v ...interface{})
- func (x Backend) Error(v ...interface{})
- func (x Backend) Errorf(f string, v ...interface{})
- func (x Backend) Fatal(v ...interface{})
- func (x Backend) Fatalf(f string, v ...interface{})
- func (x Backend) Info(v ...interface{})
- func (x Backend) Infof(f string, v ...interface{})
- func (x Backend) Level() Level
- func (x Backend) Logger() *log.Logger
- func (x Backend) NewLogger(subsystem string) Logger
- func (x Backend) NewWriter(l Level) io.Writer
- func (x Backend) Noop(...interface{})
- func (x *Backend) SetLevel(l Level) Logger
- func (x *Backend) SetLevelString(s string) Logger
- func (x Backend) Trace(v ...interface{})
- func (x Backend) Tracef(f string, v ...interface{})
- func (x Backend) Warn(v ...interface{})
- func (x Backend) Warnf(f string, v ...interface{})
- func (x *Backend) WithColor(b bool) Logger
- func (x *Backend) WithFlags(f int) 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 Closure
- 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.FgBlue 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, ...interface{}) {}
Functions ¶
func ParseFlags ¶
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
func (*Backend) SetLevelString ¶
func (*Backend) WithSampler ¶
type Closure ¶
type Closure func() string
Closure is a closure that can be printed with %v to be used to generate expensive-to-create data for a detailed log level and avoid doing the work if the data isn't printed.
func NewClosure ¶
NewLogClosure returns a new closure over the passed function which allows it to be used as a parameter in a logging function that is only invoked when the logging level is such that the message will actually be logged.
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 int
func ParseLevel ¶
func (Level) MarshalText ¶
func (*Level) UnmarshalText ¶
type Logger ¶
type Logger interface {
Noop(...interface{})
Trace(v ...interface{})
Tracef(f string, v ...interface{})
Debug(v ...interface{})
Debugf(f string, v ...interface{})
Info(v ...interface{})
Infof(f string, v ...interface{})
Warn(v ...interface{})
Warnf(f string, v ...interface{})
Error(v ...interface{})
Errorf(f string, v ...interface{})
Fatal(v ...interface{})
Fatalf(f string, v ...interface{})
Level() Level
SetLevel(Level) Logger
SetLevelString(string) Logger
Logger() *logpkg.Logger
Clone() Logger
WithTag(tag string) Logger
WithSampler(s *Sampler) Logger
WithColor(b bool) Logger
WithFlags(f int) 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.