Documentation ¶
Index ¶
- Constants
- func InitLogging(id string, color bool, loggers []*LoggerConfig) (err error)
- type Backend
- type DefaultLogger
- func (l *DefaultLogger) Critical(args ...interface{})
- func (l *DefaultLogger) Criticalf(format string, args ...interface{})
- func (l *DefaultLogger) Debug(args ...interface{})
- func (l *DefaultLogger) Debugf(format string, args ...interface{})
- func (l *DefaultLogger) Error(args ...interface{})
- func (l *DefaultLogger) Errorf(format string, args ...interface{})
- func (l *DefaultLogger) Fatal(args ...interface{})
- func (l *DefaultLogger) Fatalf(format string, args ...interface{})
- func (l *DefaultLogger) Info(args ...interface{})
- func (l *DefaultLogger) Infof(format string, args ...interface{})
- func (l *DefaultLogger) Notice(args ...interface{})
- func (l *DefaultLogger) Noticef(format string, args ...interface{})
- func (l *DefaultLogger) Panic(args ...interface{})
- func (l *DefaultLogger) Panicf(format string, args ...interface{})
- func (l *DefaultLogger) Warning(args ...interface{})
- func (l *DefaultLogger) Warningf(format string, args ...interface{})
- func (l *DefaultLogger) Write(p []byte) (n int, err error)
- type Logger
- type LoggerConfig
Constants ¶
const ( CRITICAL level = iota ERROR WARNING NOTICE INFO DEBUG )
Logging levels
Variables ¶
This section is empty.
Functions ¶
func InitLogging ¶ added in v0.12.0
func InitLogging(id string, color bool, loggers []*LoggerConfig) (err error)
InitLogging initializes logging system with an identifier for the log messages, whether the output should be in colored mode and a set of logger configs.
Types ¶
type Backend ¶ added in v0.20.0
type Backend interface {
Core(msgPriority zap.LevelEnablerFunc, encoder zapcore.Encoder) zapcore.Core
}
Backend describes a logging backend
func NewFileBackend ¶ added in v0.20.0
NewFileBackend returns a logging backend that outputs to a file
func NewStdioBackend ¶ added in v0.20.0
NewStdioBackend returns a logging backend that outputs to the standard output
func NewSyslogBackend ¶ added in v0.20.0
NewSyslogBackend returns a new backend that outputs to syslog
type DefaultLogger ¶ added in v0.23.0
DefaultLogger describes an identifier logger
func (*DefaultLogger) Critical ¶ added in v0.23.0
func (l *DefaultLogger) Critical(args ...interface{})
Critical logs a message using CRITICAL as log level.
func (*DefaultLogger) Criticalf ¶ added in v0.23.0
func (l *DefaultLogger) Criticalf(format string, args ...interface{})
Criticalf logs a message using CRITICAL as log level.
func (*DefaultLogger) Debug ¶ added in v0.23.0
func (l *DefaultLogger) Debug(args ...interface{})
Debug logs a message using DEBUG as log level.
func (*DefaultLogger) Debugf ¶ added in v0.23.0
func (l *DefaultLogger) Debugf(format string, args ...interface{})
Debugf logs a message using DEBUG as log level.
func (*DefaultLogger) Error ¶ added in v0.23.0
func (l *DefaultLogger) Error(args ...interface{})
Error logs a message using ERROR as log level.
func (*DefaultLogger) Errorf ¶ added in v0.23.0
func (l *DefaultLogger) Errorf(format string, args ...interface{})
Errorf logs a message using ERROR as log level.
func (*DefaultLogger) Fatal ¶ added in v0.23.0
func (l *DefaultLogger) Fatal(args ...interface{})
Fatal is equivalent to l.Critical(fmt.Sprint()) followed by a call to os.Exit(1).
func (*DefaultLogger) Fatalf ¶ added in v0.23.0
func (l *DefaultLogger) Fatalf(format string, args ...interface{})
Fatalf is equivalent to l.Critical followed by a call to os.Exit(1).
func (*DefaultLogger) Info ¶ added in v0.23.0
func (l *DefaultLogger) Info(args ...interface{})
Info logs a message using INFO as log level.
func (*DefaultLogger) Infof ¶ added in v0.23.0
func (l *DefaultLogger) Infof(format string, args ...interface{})
Infof logs a message using INFO as log level.
func (*DefaultLogger) Notice ¶ added in v0.23.0
func (l *DefaultLogger) Notice(args ...interface{})
Notice logs a message using NOTICE as log level.
func (*DefaultLogger) Noticef ¶ added in v0.23.0
func (l *DefaultLogger) Noticef(format string, args ...interface{})
Noticef logs a message using NOTICE as log level.
func (*DefaultLogger) Panic ¶ added in v0.23.0
func (l *DefaultLogger) Panic(args ...interface{})
Panic is equivalent to l.Critical(fmt.Sprint()) followed by a call to panic().
func (*DefaultLogger) Panicf ¶ added in v0.23.0
func (l *DefaultLogger) Panicf(format string, args ...interface{})
Panicf is equivalent to l.Critical followed by a call to panic().
func (*DefaultLogger) Warning ¶ added in v0.23.0
func (l *DefaultLogger) Warning(args ...interface{})
Warning logs a message using WARNING as log level.
func (*DefaultLogger) Warningf ¶ added in v0.23.0
func (l *DefaultLogger) Warningf(format string, args ...interface{})
Warningf logs a message using WARNING as log level.
type Logger ¶ added in v0.12.0
type Logger interface { Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) Panic(args ...interface{}) Panicf(format string, args ...interface{}) Critical(args ...interface{}) Criticalf(format string, args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) Warning(args ...interface{}) Warningf(format string, args ...interface{}) Notice(args ...interface{}) Noticef(format string, args ...interface{}) Info(args ...interface{}) Infof(format string, args ...interface{}) Debug(args ...interface{}) Debugf(format string, args ...interface{}) }
Logger is an logger interface
type LoggerConfig ¶ added in v0.21.0
type LoggerConfig struct {
// contains filtered or unexported fields
}
LoggerConfig describes a logger configuration such as backend, log level or an encoding
func NewLoggerConfig ¶ added in v0.21.0
func NewLoggerConfig(backend Backend, logLevel string, encoding string) *LoggerConfig
NewLoggerConfig returns a logger configuration with the associated logging backend, log level and encoding