Documentation ¶
Overview ¶
Package zwrap provides a wrapper for zerolog.Logger that implements the standard library's log.Logger methods, as well as other common logging methods as an attempt to provide compatibility with other logging libraries.
Index ¶
- type Logger
- func (l *Logger) Debug(v ...interface{})
- func (l *Logger) Debugf(format string, v ...interface{})
- func (l *Logger) Debugln(v ...interface{})
- func (l *Logger) Error(v ...interface{})
- func (l *Logger) Errorf(format string, v ...interface{})
- func (l *Logger) Errorln(v ...interface{})
- func (l *Logger) Fatal(v ...interface{})
- func (l *Logger) Fatalf(format string, v ...interface{})
- func (l *Logger) Fatalln(v ...interface{})
- func (l *Logger) Info(v ...interface{})
- func (l *Logger) Infof(format string, v ...interface{})
- func (l *Logger) Infoln(v ...interface{})
- func (l *Logger) Logf(format string, v ...interface{})
- func (l *Logger) Noticef(format string, v ...interface{})
- func (l *Logger) Output(calldepth int, s string) error
- func (l *Logger) Panic(v ...interface{})
- func (l *Logger) Panicf(format string, v ...interface{})
- func (l *Logger) Panicln(v ...interface{})
- func (l *Logger) Prefix() string
- func (l *Logger) Print(v ...interface{})
- func (l *Logger) Printf(format string, v ...interface{})
- func (l *Logger) Println(v ...interface{})
- func (l *Logger) SetLevel(level uint32)
- func (l *Logger) SetPrefix(prefix string)
- func (l *Logger) SetPrintLevel(level zerolog.Level)
- func (l *Logger) Trace(v ...interface{})
- func (l *Logger) Tracef(format string, v ...interface{})
- func (l *Logger) Traceln(v ...interface{})
- func (l *Logger) Verbosef(format string, v ...interface{})
- func (l *Logger) Warn(v ...interface{})
- func (l *Logger) Warnf(format string, v ...interface{})
- func (l *Logger) Warningf(format string, v ...interface{})
- func (l *Logger) Warnln(v ...interface{})
- func (l *Logger) WithFields(fields map[string]interface{}) *Logger
- func (l *Logger) WithPrefix(prefix string) *Logger
- func (l *Logger) Write(p []byte) (n int, err error)
- type StdCompatLogger
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
func Wrap ¶
Example ¶
// Create a new zerolog.Logger logger := zerolog.New(os.Stderr).With().Timestamp().Logger() // Demonstrate that we can use the stdlib logger myThing := &needsLogger{} myThing.SetLogger(log.New(os.Stderr, "stdlog: ", log.LstdFlags)) myThing.DoSomething() // Demonstrate that we can use zerolog when wrapped /* Before, does not compile: myThing.SetLogger(logger) myThing.DoSomething() */ */ // The zwrap solution, wrap the logger: zl := Wrap(logger) myThing.SetLogger(zl) myThing.DoSomething()
Output:
func (*Logger) SetLevel ¶ added in v0.4.2
SetLevel is compatibility for ghettovoice/gosip/log.Logger
func (*Logger) SetPrintLevel ¶
func (*Logger) WithFields ¶ added in v0.4.2
func (*Logger) WithPrefix ¶ added in v0.4.2
type StdCompatLogger ¶
type StdCompatLogger interface { Fatal(v ...interface{}) Fatalf(format string, v ...interface{}) Fatalln(v ...interface{}) Panic(v ...interface{}) Panicf(format string, v ...interface{}) Panicln(v ...interface{}) Prefix() string Print(v ...interface{}) Printf(format string, v ...interface{}) Println(v ...interface{}) SetPrefix(prefix string) Output(calldepth int, s string) error }
StdCompatLogger is an interface that provides compatibility with the standard library's log.Logger.
Click to show internal directories.
Click to hide internal directories.