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 ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ContextKey = contextKey{}
ContextKey is the key to store Logger in the context.
Functions ¶
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) 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.
Click to show internal directories.
Click to hide internal directories.