Documentation ¶
Index ¶
- Constants
- func Debug() *zerolog.Event
- func Debugf(format string, v ...interface{})
- func Debugln(v ...interface{})
- func Error() *zerolog.Event
- func Errorf(format string, v ...interface{})
- func Errorln(v ...interface{})
- func Fatal() *zerolog.Event
- func Fatalf(format string, v ...interface{})
- func Fatalln(v ...interface{})
- func GetLevel() zerolog.Level
- func GetPrettyConsoleWriter() io.Writer
- func Info() *zerolog.Event
- func Infof(format string, v ...interface{})
- func Infoln(v ...interface{})
- func Log() *zerolog.Event
- func NewZapAdapter(logger *Logger, component string) zapcore.Core
- func Panic() *zerolog.Event
- func Panicf(format string, v ...interface{})
- func Panicln(v ...interface{})
- func Print(v ...interface{})
- func Printf(format string, v ...interface{})
- func Println(v ...interface{})
- func SetGlobalLevel(level zerolog.Level)
- func SetGlobalLevelString(levelString string) error
- func SetGlobalLogger(lg *Logger)
- func SetStdLogger(lg *Logger)
- func Trace() *zerolog.Event
- func WaitFlush()
- func Warn() *zerolog.Event
- func Warnf(format string, v ...interface{})
- func Warnln(v ...interface{})
- func With() zerolog.Context
- func WithLevel(level zerolog.Level) *zerolog.Event
- func Write(p []byte) (n int, err error)
- type Logger
- func GetGlobalLogger() *Logger
- func Hook(hook zerolog.Hook) *Logger
- func Level(level zerolog.Level) *Logger
- func NewDefaultLogger() *Logger
- func NewLogger(w io.Writer, levelString string) *Logger
- func Output(w io.Writer) *Logger
- func Sample(sampler zerolog.Sampler) *Logger
- func WithBool(key string, value bool) *Logger
- func WithComponent(component string) *Logger
- func WithInterface(key string, value interface{}) *Logger
- func WithStr(key string, value string) *Logger
- func (lg *Logger) Debug() *zerolog.Event
- func (lg *Logger) Debugf(format string, v ...interface{})
- func (lg *Logger) Debugln(v ...interface{})
- func (lg *Logger) Error() *zerolog.Event
- func (lg *Logger) Errorf(format string, v ...interface{})
- func (lg *Logger) Errorln(v ...interface{})
- func (lg *Logger) Fatal() *zerolog.Event
- func (lg *Logger) Fatalf(format string, v ...interface{})
- func (lg *Logger) Fatalln(v ...interface{})
- func (lg *Logger) GetLevel() zerolog.Level
- func (lg *Logger) GetZerolog() *zerolog.Logger
- func (lg *Logger) Hook(hook zerolog.Hook) *Logger
- func (lg *Logger) Info() *zerolog.Event
- func (lg *Logger) Infof(format string, v ...interface{})
- func (lg *Logger) Infoln(v ...interface{})
- func (lg *Logger) Level(level zerolog.Level) *Logger
- func (lg *Logger) Log() *zerolog.Event
- func (lg *Logger) NewFromZerolog(logger *zerolog.Logger) *Logger
- func (lg *Logger) Output(w io.Writer) *Logger
- func (lg *Logger) Panic() *zerolog.Event
- func (lg *Logger) Panicf(format string, v ...interface{})
- func (lg *Logger) Panicln(v ...interface{})
- func (lg *Logger) Print(v ...interface{})
- func (lg *Logger) Printf(format string, v ...interface{})
- func (lg *Logger) Println(v ...interface{})
- func (lg *Logger) Sample(sampler zerolog.Sampler) *Logger
- func (lg *Logger) Trace() *zerolog.Event
- func (lg *Logger) Warn() *zerolog.Event
- func (lg *Logger) Warnf(format string, v ...interface{})
- func (lg *Logger) Warnln(v ...interface{})
- func (lg *Logger) With() zerolog.Context
- func (lg *Logger) WithBool(key string, value bool) *Logger
- func (lg *Logger) WithComponent(component string) *Logger
- func (lg *Logger) WithInterface(key string, value interface{}) *Logger
- func (lg *Logger) WithLevel(level zerolog.Level) *zerolog.Event
- func (lg *Logger) WithStr(key string, value string) *Logger
- func (lg *Logger) Write(p []byte) (n int, err error)
Constants ¶
const ( // DebugLevel defines debug log level. DebugLevel = zerolog.DebugLevel // InfoLevel defines info log level. InfoLevel = zerolog.InfoLevel // WarnLevel defines warn log level. WarnLevel = zerolog.WarnLevel // ErrorLevel defines error log level. ErrorLevel = zerolog.ErrorLevel // FatalLevel defines fatal log level. FatalLevel = zerolog.FatalLevel // PanicLevel defines panic log level. PanicLevel = zerolog.PanicLevel // NoLevel defines an absent log level. NoLevel = zerolog.NoLevel // Disabled disables the logger. Disabled = zerolog.Disabled // TraceLevel defines trace log level. TraceLevel = zerolog.TraceLevel )
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
Debug starts a new message with debug level.
You must call Msg on the returned event in order to send the event.
func Debugf ¶
func Debugf(format string, v ...interface{})
Debugf sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Printf.
func Debugln ¶
func Debugln(v ...interface{})
Debugln sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Println.
func Error ¶
Error starts a new message with error level.
You must call Msg on the returned event in order to send the event.
func Errorf ¶
func Errorf(format string, v ...interface{})
Errorf sends a log event using error level and no extra field. Arguments are handled in the manner of fmt.Printf.
func Errorln ¶
func Errorln(v ...interface{})
Errorln sends a log event using error level and no extra field. Arguments are handled in the manner of fmt.Println.
func Fatal ¶
Fatal starts a new message with fatal level.
You must call Msg on the returned event in order to send the event.
func Fatalf ¶
func Fatalf(format string, v ...interface{})
Fatalf sends a log event using fatal level and no extra field. Arguments are handled in the manner of fmt.Printf.
func Fatalln ¶
func Fatalln(v ...interface{})
Fatalln sends a log event using fatal level and no extra field. Arguments are handled in the manner of fmt.Println.
func GetPrettyConsoleWriter ¶ added in v0.3.0
GetPrettyConsoleWriter returns a pretty console writer.
func Info ¶
Info starts a new message with info level.
You must call Msg on the returned event in order to send the event.
func Infof ¶
func Infof(format string, v ...interface{})
Infof sends a log event using info level and no extra field. Arguments are handled in the manner of fmt.Printf.
func Infoln ¶
func Infoln(v ...interface{})
Infoln sends a log event using info level and no extra field. Arguments are handled in the manner of fmt.Println.
func Log ¶
Log starts a new message with no level. This is equivalent to using WithLevel(NoLevel).
You must call Msg on the returned event in order to send the event.
func NewZapAdapter ¶ added in v0.3.0
NewZapAdapter returns a new zapcore Core logger interface that converts given logger's io.writer to WriteSyncer.
func Panic ¶
Panic starts a new message with panic level. The message is also sent to the panic function.
You must call Msg on the returned event in order to send the event.
func Panicf ¶
func Panicf(format string, v ...interface{})
Panicf sends a log event using panic level and no extra field. Arguments are handled in the manner of fmt.Printf.
func Panicln ¶
func Panicln(v ...interface{})
Panicln sends a log event using panic level and no extra field. Arguments are handled in the manner of fmt.Println.
func Print ¶
func Print(v ...interface{})
Print sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Print.
func Printf ¶
func Printf(format string, v ...interface{})
Printf sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Printf.
func Println ¶
func Println(v ...interface{})
Println sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Println.
func SetGlobalLevel ¶
SetGlobalLevel sets the global log level with given level.
func SetGlobalLevelString ¶
SetGlobalLevelString parses given levelString and sets the global log level.
func SetGlobalLogger ¶
func SetGlobalLogger(lg *Logger)
SetGlobalLogger closes the previous global logger and sets given logger as a new global logger.
func Trace ¶
Trace starts a new message with trace level.
You must call Msg on the returned event in order to send the event.
func Warn ¶
Warn starts a new message with warn level.
You must call Msg on the returned event in order to send the event.
func Warnf ¶
func Warnf(format string, v ...interface{})
Warnf sends a log event using warn level and no extra field. Arguments are handled in the manner of fmt.Printf.
func Warnln ¶
func Warnln(v ...interface{})
Warnln sends a log event using warn level and no extra field. Arguments are handled in the manner of fmt.Println.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is wrapper around zerolog.Logger and io.writers.
func Level ¶
Level creates a child logger of the global logger with the minimum accepted level set to level.
func NewDefaultLogger ¶
func NewDefaultLogger() *Logger
NewDefaultLogger creates a new default logger with default settings.
func WithComponent ¶ added in v0.3.0
WithComponent enables the global logger to chain loggers with additional context, component name.
func WithInterface ¶ added in v0.3.0
WithInterface adds an interface to the global logger context.
func (*Logger) Debug ¶
Debug starts a new message with debug level.
You must call Msg on the returned event in order to send the event.
func (*Logger) Debugf ¶
Debugf sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Debugln ¶
func (lg *Logger) Debugln(v ...interface{})
Debugln sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Println.
func (*Logger) Error ¶
Error starts a new message with error level.
You must call Msg on the returned event in order to send the event.
func (*Logger) Errorf ¶
Errorf sends a log event using error level and no extra field. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Errorln ¶
func (lg *Logger) Errorln(v ...interface{})
Errorln sends a log event using error level and no extra field. Arguments are handled in the manner of fmt.Println.
func (*Logger) Fatal ¶
Fatal starts a new message with fatal level. This is an alias for Panic.
You must call Msg on the returned event in order to send the event.
func (*Logger) Fatalf ¶
Fatalf sends a log event using fatal level and no extra field. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Fatalln ¶
func (lg *Logger) Fatalln(v ...interface{})
Fatalln sends a log event using fatal level and no extra field. Arguments are handled in the manner of fmt.Println.
func (*Logger) GetZerolog ¶ added in v0.3.0
GetZerolog returns underlying zerolog logger.
func (*Logger) Info ¶
Info starts a new message with info level.
You must call Msg on the returned event in order to send the event.
func (*Logger) Infof ¶
Infof sends a log event using info level and no extra field. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Infoln ¶
func (lg *Logger) Infoln(v ...interface{})
Infoln sends a log event using info level and no extra field. Arguments are handled in the manner of fmt.Println.
func (*Logger) Level ¶
Level creates a child logger of the current logger with the minimum accepted level set to level.
func (*Logger) Log ¶
Log starts a new message with no level. This is equivalent to using lg.WithLevel(NoLevel).
You must call Msg on the returned event in order to send the event.
func (*Logger) NewFromZerolog ¶ added in v0.3.0
NewFromZerolog creates the logger from zerolog instance.
func (*Logger) Panic ¶
Panic starts a new message with panic level. The panic() function is called by the Msg method, which stops the ordinary flow of a goroutine and invokes any registered PanicHandler.
You must call Msg on the returned event in order to send the event.
func (*Logger) Panicf ¶
Panicf sends a log event using panic level and no extra field. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Panicln ¶
func (lg *Logger) Panicln(v ...interface{})
Panicln sends a log event using panic level and no extra field. Arguments are handled in the manner of fmt.Println.
func (*Logger) Print ¶
func (lg *Logger) Print(v ...interface{})
Print sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Print.
func (*Logger) Printf ¶
Printf sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Println ¶
func (lg *Logger) Println(v ...interface{})
Println sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Println.
func (*Logger) Trace ¶
Trace starts a new message with trace level.
You must call Msg on the returned event in order to send the event.
func (*Logger) Warn ¶
Warn starts a new message with warn level.
You must call Msg on the returned event in order to send the event.
func (*Logger) Warnf ¶
Warnf sends a log event using warn level and no extra field. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Warnln ¶
func (lg *Logger) Warnln(v ...interface{})
Warnln sends a log event using warn level and no extra field. Arguments are handled in the manner of fmt.Println.
func (*Logger) With ¶
With creates a child logger of the current logger with the field added to its context.
func (*Logger) WithComponent ¶ added in v0.3.0
WithComponent enables the current logger to chain loggers with additional context, component name.
func (*Logger) WithInterface ¶ added in v0.3.0
WithInterface adds an interface to the logger context.
func (*Logger) WithLevel ¶
WithLevel starts a new message with level. Unlike Fatal and Panic methods, WithLevel does not terminate the program or stop the ordinary flow of a goroutine when used with their respective levels.
You must call Msg on the returned event in order to send the event.