Versions in this module Expand all Collapse all v1 v1.34.2 Nov 19, 2024 v1.34.1 Nov 18, 2024 Changes in this version + const TimeFormatUnix + const TimeFormatUnixMicro + const TimeFormatUnixMs + const TimeFormatUnixNano + var CallerFieldName = "caller" + var CallerMarshalFunc = func(pc uintptr, file string, line int) string + var CallerSkipFrameCount = 2 + var DefaultContextLogger *Logger + var DurationFieldInteger = false + var DurationFieldUnit = time.Millisecond + var ErrorFieldName = "error" + var ErrorHandler func(err error) + var ErrorMarshalFunc = func(err error) interface{} + var ErrorStackFieldName = "stack" + var ErrorStackMarshaler func(err error) interface + var FloatingPointPrecision = -1 + var FormattedLevels = map[Level]string + var InterfaceMarshalFunc = func(v interface{}) ([]byte, error) + var LevelColors = map[Level]int + var LevelDebugValue = "debug" + var LevelErrorValue = "error" + var LevelFatalValue = "fatal" + var LevelFieldMarshalFunc = func(l Level) string + var LevelFieldName = "level" + var LevelInfoValue = "info" + var LevelPanicValue = "panic" + var LevelTraceValue = "trace" + var LevelWarnValue = "warn" + var MessageFieldName = "message" + var Often = RandomSampler(10) + var Rarely = RandomSampler(1000) + var Sometimes = RandomSampler(100) + var TimeFieldFormat = time.RFC3339 + var TimestampFieldName = "time" + var TimestampFunc = time.Now + var TriggerLevelWriterBufferReuseLimit = 64 * 1024 + func ConsoleTestWriter(t TestingLog) func(w *ConsoleWriter) + func DisableSampling(v bool) + func SetGlobalLevel(l Level) + func SyncWriter(w io.Writer) io.Writer + type Array struct + func Arr() *Array + func (*Array) MarshalZerologArray(*Array) + func (a *Array) Bool(b bool) *Array + func (a *Array) Bytes(val []byte) *Array + func (a *Array) Dict(dict *Event) *Array + func (a *Array) Dur(d time.Duration) *Array + func (a *Array) Err(err error) *Array + func (a *Array) Float32(f float32) *Array + func (a *Array) Float64(f float64) *Array + func (a *Array) Hex(val []byte) *Array + func (a *Array) IPAddr(ip net.IP) *Array + func (a *Array) IPPrefix(pfx net.IPNet) *Array + func (a *Array) Int(i int) *Array + func (a *Array) Int16(i int16) *Array + func (a *Array) Int32(i int32) *Array + func (a *Array) Int64(i int64) *Array + func (a *Array) Int8(i int8) *Array + func (a *Array) Interface(i interface{}) *Array + func (a *Array) MACAddr(ha net.HardwareAddr) *Array + func (a *Array) Object(obj LogObjectMarshaler) *Array + func (a *Array) RawJSON(val []byte) *Array + func (a *Array) Str(val string) *Array + func (a *Array) Time(t time.Time) *Array + func (a *Array) Uint(i uint) *Array + func (a *Array) Uint16(i uint16) *Array + func (a *Array) Uint32(i uint32) *Array + func (a *Array) Uint64(i uint64) *Array + func (a *Array) Uint8(i uint8) *Array + type BasicSampler struct + N uint32 + func (s *BasicSampler) Sample(lvl Level) bool + type BurstSampler struct + Burst uint32 + NextSampler Sampler + Period time.Duration + func (s *BurstSampler) Sample(lvl Level) bool + type ConsoleWriter struct + FieldsExclude []string + FieldsOrder []string + FormatCaller Formatter + FormatErrFieldName Formatter + FormatErrFieldValue Formatter + FormatExtra func(map[string]interface{}, *bytes.Buffer) error + FormatFieldName Formatter + FormatFieldValue Formatter + FormatLevel Formatter + FormatMessage Formatter + FormatPrepare func(map[string]interface{}) error + FormatTimestamp Formatter + NoColor bool + Out io.Writer + PartsExclude []string + PartsOrder []string + TimeFormat string + TimeLocation *time.Location + func NewConsoleWriter(options ...func(w *ConsoleWriter)) ConsoleWriter + func (w ConsoleWriter) Close() error + func (w ConsoleWriter) Write(p []byte) (n int, err error) + type Context struct + func (c Context) AnErr(key string, err error) Context + func (c Context) Any(key string, i interface{}) Context + func (c Context) Array(key string, arr LogArrayMarshaler) Context + func (c Context) Bool(key string, b bool) Context + func (c Context) Bools(key string, b []bool) Context + func (c Context) Bytes(key string, val []byte) Context + func (c Context) Caller() Context + func (c Context) CallerWithSkipFrameCount(skipFrameCount int) Context + func (c Context) Ctx(ctx context.Context) Context + func (c Context) DeDup() Context + func (c Context) DeDupDeep() Context + func (c Context) Dict(key string, dict *Event) Context + func (c Context) Dur(key string, d time.Duration) Context + func (c Context) Durs(key string, d []time.Duration) Context + func (c Context) EmbedObject(obj LogObjectMarshaler) Context + func (c Context) Err(err error) Context + func (c Context) Errs(key string, errs []error) Context + func (c Context) Fields(fields interface{}) Context + func (c Context) Float32(key string, f float32) Context + func (c Context) Float64(key string, f float64) Context + func (c Context) Floats32(key string, f []float32) Context + func (c Context) Floats64(key string, f []float64) Context + func (c Context) Hex(key string, val []byte) Context + func (c Context) IPAddr(key string, ip net.IP) Context + func (c Context) IPPrefix(key string, pfx net.IPNet) Context + func (c Context) Int(key string, i int) Context + func (c Context) Int16(key string, i int16) Context + func (c Context) Int32(key string, i int32) Context + func (c Context) Int64(key string, i int64) Context + func (c Context) Int8(key string, i int8) Context + func (c Context) Interface(key string, i interface{}) Context + func (c Context) Ints(key string, i []int) Context + func (c Context) Ints16(key string, i []int16) Context + func (c Context) Ints32(key string, i []int32) Context + func (c Context) Ints64(key string, i []int64) Context + func (c Context) Ints8(key string, i []int8) Context + func (c Context) Logger() Logger + func (c Context) MACAddr(key string, ha net.HardwareAddr) Context + func (c Context) Object(key string, obj LogObjectMarshaler) Context + func (c Context) RawJSON(key string, b []byte) Context + func (c Context) Reset() Context + func (c Context) Stack() Context + func (c Context) Str(key, val string) Context + func (c Context) Stringer(key string, val fmt.Stringer) Context + func (c Context) Strs(key string, vals []string) Context + func (c Context) Time(key string, t time.Time) Context + func (c Context) Times(key string, t []time.Time) Context + func (c Context) Timestamp() Context + func (c Context) Type(key string, val interface{}) Context + func (c Context) Uint(key string, i uint) Context + func (c Context) Uint16(key string, i uint16) Context + func (c Context) Uint32(key string, i uint32) Context + func (c Context) Uint64(key string, i uint64) Context + func (c Context) Uint8(key string, i uint8) Context + func (c Context) Uints(key string, i []uint) Context + func (c Context) Uints16(key string, i []uint16) Context + func (c Context) Uints32(key string, i []uint32) Context + func (c Context) Uints64(key string, i []uint64) Context + func (c Context) Uints8(key string, i []uint8) Context + type Event struct + func Dict() *Event + func (e *Event) AnErr(key string, err error) *Event + func (e *Event) Any(key string, i interface{}) *Event + func (e *Event) Array(key string, arr LogArrayMarshaler) *Event + func (e *Event) Bool(key string, b bool) *Event + func (e *Event) Bools(key string, b []bool) *Event + func (e *Event) Bytes(key string, val []byte) *Event + func (e *Event) Caller(skip ...int) *Event + func (e *Event) CallerSkipFrame(skip int) *Event + func (e *Event) Ctx(ctx context.Context) *Event + func (e *Event) DeDup() *Event + func (e *Event) DeDupDeep() *Event + func (e *Event) Dict(key string, dict *Event) *Event + func (e *Event) Discard() *Event + func (e *Event) Dur(key string, d time.Duration) *Event + func (e *Event) Durs(key string, d []time.Duration) *Event + func (e *Event) EmbedObject(obj LogObjectMarshaler) *Event + func (e *Event) Enabled() bool + func (e *Event) Err(err error) *Event + func (e *Event) Errs(key string, errs []error) *Event + func (e *Event) Fields(fields interface{}) *Event + func (e *Event) Float32(key string, f float32) *Event + func (e *Event) Float64(key string, f float64) *Event + func (e *Event) Floats32(key string, f []float32) *Event + func (e *Event) Floats64(key string, f []float64) *Event + func (e *Event) Func(f func(e *Event)) *Event + func (e *Event) GetCtx() context.Context + func (e *Event) Hex(key string, val []byte) *Event + func (e *Event) IPAddr(key string, ip net.IP) *Event + func (e *Event) IPPrefix(key string, pfx net.IPNet) *Event + func (e *Event) Int(key string, i int) *Event + func (e *Event) Int16(key string, i int16) *Event + func (e *Event) Int32(key string, i int32) *Event + func (e *Event) Int64(key string, i int64) *Event + func (e *Event) Int8(key string, i int8) *Event + func (e *Event) Interface(key string, i interface{}) *Event + func (e *Event) Ints(key string, i []int) *Event + func (e *Event) Ints16(key string, i []int16) *Event + func (e *Event) Ints32(key string, i []int32) *Event + func (e *Event) Ints64(key string, i []int64) *Event + func (e *Event) Ints8(key string, i []int8) *Event + func (e *Event) MACAddr(key string, ha net.HardwareAddr) *Event + func (e *Event) Msg(msg string) + func (e *Event) MsgFunc(createMsg func() string) + func (e *Event) Msgf(format string, v ...interface{}) + func (e *Event) Object(key string, obj LogObjectMarshaler) *Event + func (e *Event) RawCBOR(key string, b []byte) *Event + func (e *Event) RawJSON(key string, b []byte) *Event + func (e *Event) Send() + func (e *Event) Stack() *Event + func (e *Event) Str(key, val string) *Event + func (e *Event) Stringer(key string, val fmt.Stringer) *Event + func (e *Event) Stringers(key string, vals []fmt.Stringer) *Event + func (e *Event) Strs(key string, vals []string) *Event + func (e *Event) Time(key string, t time.Time) *Event + func (e *Event) TimeDiff(key string, t time.Time, start time.Time) *Event + func (e *Event) Times(key string, t []time.Time) *Event + func (e *Event) Timestamp() *Event + func (e *Event) Type(key string, val interface{}) *Event + func (e *Event) Uint(key string, i uint) *Event + func (e *Event) Uint16(key string, i uint16) *Event + func (e *Event) Uint32(key string, i uint32) *Event + func (e *Event) Uint64(key string, i uint64) *Event + func (e *Event) Uint8(key string, i uint8) *Event + func (e *Event) Uints(key string, i []uint) *Event + func (e *Event) Uints16(key string, i []uint16) *Event + func (e *Event) Uints32(key string, i []uint32) *Event + func (e *Event) Uints64(key string, i []uint64) *Event + func (e *Event) Uints8(key string, i []uint8) *Event + type FilteredLevelWriter struct + Level Level + Writer LevelWriter + func (w *FilteredLevelWriter) Write(p []byte) (int, error) + func (w *FilteredLevelWriter) WriteLevel(level Level, p []byte) (int, error) + type Formatter func(interface{}) string + type Hook interface + Run func(e *Event, level Level, message string) + type HookFunc func(e *Event, level Level, message string) + func (h HookFunc) Run(e *Event, level Level, message string) + type Level int8 + const DebugLevel + const Disabled + const ErrorLevel + const FatalLevel + const InfoLevel + const NoLevel + const PanicLevel + const TraceLevel + const WarnLevel + func GlobalLevel() Level + func ParseLevel(levelStr string) (Level, error) + func (l *Level) UnmarshalText(text []byte) error + func (l Level) MarshalText() ([]byte, error) + func (l Level) String() string + type LevelHook struct + DebugHook Hook + ErrorHook Hook + FatalHook Hook + InfoHook Hook + NoLevelHook Hook + PanicHook Hook + TraceHook Hook + WarnHook Hook + func NewLevelHook() LevelHook + func (h LevelHook) Run(e *Event, level Level, message string) + type LevelSampler struct + DebugSampler Sampler + ErrorSampler Sampler + InfoSampler Sampler + TraceSampler Sampler + WarnSampler Sampler + func (s LevelSampler) Sample(lvl Level) bool + type LevelWriter interface + WriteLevel func(level Level, p []byte) (n int, err error) + func MultiLevelWriter(writers ...io.Writer) LevelWriter + func SyslogCEEWriter(w SyslogWriter) LevelWriter + func SyslogLevelWriter(w SyslogWriter) LevelWriter + type LevelWriterAdapter struct + func (lw LevelWriterAdapter) Close() error + func (lw LevelWriterAdapter) WriteLevel(l Level, p []byte) (n int, err error) + type LogArrayMarshaler interface + MarshalZerologArray func(a *Array) + type LogObjectMarshaler interface + MarshalZerologObject func(e *Event) + type Logger struct + func Ctx(ctx context.Context) *Logger + func New(w io.Writer) Logger + func Nop() Logger + func (l *Logger) Debug() *Event + func (l *Logger) Err(err error) *Event + func (l *Logger) Error() *Event + func (l *Logger) Fatal() *Event + func (l *Logger) Info() *Event + func (l *Logger) Log() *Event + func (l *Logger) Panic() *Event + func (l *Logger) Print(v ...interface{}) + func (l *Logger) Printf(format string, v ...interface{}) + func (l *Logger) Println(v ...interface{}) + func (l *Logger) Trace() *Event + func (l *Logger) UpdateContext(update func(c Context) Context) + func (l *Logger) Warn() *Event + func (l *Logger) WithLevel(level Level) *Event + func (l Logger) GetLevel() Level + func (l Logger) Hook(hooks ...Hook) Logger + func (l Logger) Level(lvl Level) Logger + func (l Logger) Output(w io.Writer) Logger + func (l Logger) Sample(s Sampler) Logger + func (l Logger) With() Context + func (l Logger) WithContext(ctx context.Context) context.Context + func (l Logger) Write(p []byte) (n int, err error) + type RandomSampler uint32 + func (s RandomSampler) Sample(lvl Level) bool + type Sampler interface + Sample func(lvl Level) bool + type SyslogWriter interface — darwin/amd64, js/wasm, linux/amd64 + Crit func(m string) error + Debug func(m string) error + Emerg func(m string) error + Err func(m string) error + Info func(m string) error + Warning func(m string) error + type TestWriter struct + Frame int + T TestingLog + func NewTestWriter(t TestingLog) TestWriter + func (t TestWriter) Write(p []byte) (n int, err error) + type TestingLog interface + Helper func() + Log func(args ...interface{}) + Logf func(format string, args ...interface{}) + type TriggerLevelWriter struct + ConditionalLevel Level + TriggerLevel Level + func (w *TriggerLevelWriter) Close() error + func (w *TriggerLevelWriter) Trigger() error + func (w *TriggerLevelWriter) WriteLevel(l Level, p []byte) (n int, err error)