Documentation ¶
Overview ¶
Package logger implements a logging system with a module tag. The module tag represents a scope where the log event is emitted.
Index ¶
- Variables
- func Debugf(f string, v ...interface{})
- func Errorf(f string, v ...interface{})
- func Infof(f string, v ...interface{})
- func Init(cfg Logging) (err error)
- func Panicf(f string, v ...interface{})
- func Proto(message proto.Message) []byte
- func Warningf(f string, v ...interface{})
- type Loggable
- type Logger
- type Logging
- type MarshalError
Constants ¶
This section is empty.
Variables ¶
var ContextKey = contextKey{}
ContextKey is the key to store Logger in the context.
Functions ¶
func Debugf ¶ added in v0.6.0
func Debugf(f string, v ...interface{})
Debugf logs a message at the debug level. It uses sprintf-style formatting for its message.
func Errorf ¶ added in v0.6.0
func Errorf(f string, v ...interface{})
Errorf logs a message at the error level. It uses sprintf-style formatting for its message.
func Infof ¶ added in v0.6.0
func Infof(f string, v ...interface{})
Infof logs a message at the info level. It uses sprintf-style formatting for its message.
func Panicf ¶ added in v0.6.0
func Panicf(f string, v ...interface{})
Panicf logs a message at the panic level. It panics after logging the message. It uses sprintf-style formatting for its message.
Types ¶
type Loggable ¶
type Loggable interface {
SetLogger(*Logger)
}
Loggable indicates the implement supports logging.
type Logger ¶
Logger is wrapper for rs/zerolog logger with module, it is singleton.
func FetchOrDefault ¶ added in v0.3.0
FetchOrDefault gets a Logger in a context, then creates a new Logger based on it If the context doesn't include a Logger. The default Logger will be picked.
func (*Logger) DefaultLevel ¶ added in v0.7.0
DefaultLevel sets the default level for the logger.
func (*Logger) Sampled ¶ added in v0.3.0
Sampled return a Logger with a sampler that will send every Nth events.
func (*Logger) ToZapConfig ¶ added in v0.3.0
ToZapConfig outputs the zap config is derived from l.
type MarshalError ¶ added in v0.3.0
type MarshalError struct {
Msg string `json:"msg"`
}
MarshalError is the error raised by marshaling a JSON object.