Documentation
¶
Index ¶
- Constants
- func Enable() error
- func Init(cmd *cobra.Command) error
- func ParseLogLevelsFromArgs(in []string) (map[string]Level, error)
- func Runner(cmd *cobra.Command, args []string) error
- func WithLevel(l *zerolog.Logger, level Level) *zerolog.Event
- func WithSamplingPeriod(p time.Duration) func(o *LoggerOptions)
- type Config
- type Factory
- type Level
- type Logger
- type LoggerIO
- type LoggerOptions
- type Sampler
- type Wrap
- func Bool(key string, i bool) Wrap
- func Dur(key string, dur time.Duration) Wrap
- func Err(err error) Wrap
- func HTTPRequestWrap(request *http.Request) Wrap
- func Int(key string, i int) Wrap
- func Int32(key string, i int32) Wrap
- func Int64(key string, i int64) Wrap
- func Interface(key string, i interface{}) Wrap
- func JSON(key string, item any) Wrap
- func SinceStart(key string, start time.Time) Wrap
- func Str(key, value string) Wrap
- func Strs(key string, values ...string) Wrap
- func Time(key string, time time.Time) Wrap
- type WrapObj
Constants ¶
View Source
const ( Trace = Level(zerolog.TraceLevel) Debug = Level(zerolog.DebugLevel) Info = Level(zerolog.InfoLevel) Warn = Level(zerolog.WarnLevel) Error = Level(zerolog.ErrorLevel) Fatal = Level(zerolog.FatalLevel) )
View Source
const TopicAll = "all"
Variables ¶
This section is empty.
Functions ¶
func WithSamplingPeriod ¶
func WithSamplingPeriod(p time.Duration) func(o *LoggerOptions)
Types ¶
type Factory ¶
type Factory interface { Get(name string, opts ...func(*LoggerOptions)) Logger LogLevels() map[string]Level Configure(cfg Config) ApplyLogLevels(in map[string]Level) SetRoot(log zerolog.Logger) RegisterLogger(name string, level Level) bool RegisterAndGetLogger(name string, level Level, opts ...func(*LoggerOptions)) Logger RegisterWrappers(w ...Wrap) Names() []string }
func NewDefaultFactory ¶
func NewDefaultFactory() Factory
func NewFactory ¶
type Level ¶
func ParseLogLevel ¶
type Logger ¶
type Logger interface { Wrap(w Wrap) Logger WrapObj(w WrapObj) Logger Bool(key string, i bool) Logger Str(key, value string) Logger JSON(key string, value any) Logger Strs(key string, values ...string) Logger SinceStart(key string, start time.Time) Logger Err(err error) Logger Int(key string, i int) Logger Int32(key string, i int32) Logger Int64(key string, i int64) Logger Interface(key string, i interface{}) Logger Dur(key string, dur time.Duration) Logger Time(key string, time time.Time) Logger Stack() Logger Trace(msg string, args ...interface{}) Debug(msg string, args ...interface{}) Info(msg string, args ...interface{}) Warn(msg string, args ...interface{}) Error(msg string, args ...interface{}) Fatal(msg string, args ...interface{}) TraceIO() LoggerIO DebugIO() LoggerIO InfoIO() LoggerIO WarnIO() LoggerIO ErrorIO() LoggerIO FatalIO() LoggerIO }
type LoggerOptions ¶
type Sampler ¶
type Sampler interface { // Sample returns true if the event should be part of the sample, false if // the event should be dropped. Sample(level Level, msg string, args ...any) bool }
Sampler defines an interface to a log sampler.
func NewLogEventSampler ¶
type Wrap ¶
func HTTPRequestWrap ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.