Versions in this module Expand all Collapse all v1 v1.0.4 Jul 20, 2023 v1.0.2 Jul 20, 2023 Changes in this version + const DefaultLineEnding + const OmitKey + var DefaultClock = systemClock + func CapitalColorLevelEncoder(l Level, enc PrimitiveArrayEncoder) + func CapitalLevelEncoder(l Level, enc PrimitiveArrayEncoder) + func EpochMillisTimeEncoder(t time.Time, enc PrimitiveArrayEncoder) + func EpochNanosTimeEncoder(t time.Time, enc PrimitiveArrayEncoder) + func EpochTimeEncoder(t time.Time, enc PrimitiveArrayEncoder) + func FullCallerEncoder(caller EntryCaller, enc PrimitiveArrayEncoder) + func FullNameEncoder(loggerName string, enc PrimitiveArrayEncoder) + func ISO8601TimeEncoder(t time.Time, enc PrimitiveArrayEncoder) + func LowercaseColorLevelEncoder(l Level, enc PrimitiveArrayEncoder) + func LowercaseLevelEncoder(l Level, enc PrimitiveArrayEncoder) + func MillisDurationEncoder(d time.Duration, enc PrimitiveArrayEncoder) + func NanosDurationEncoder(d time.Duration, enc PrimitiveArrayEncoder) + func NewStdLog(l *Logger) *log.Logger + func NewStdLogAt(l *Logger, level Level) (*log.Logger, error) + func RFC3339NanoTimeEncoder(t time.Time, enc PrimitiveArrayEncoder) + func RFC3339TimeEncoder(t time.Time, enc PrimitiveArrayEncoder) + func RedirectStdLog(l *Logger) func() + func RedirectStdLogAt(l *Logger, level Level) (func(), error) + func RegisterSink(scheme string, factory func(*url.URL) (Sink, error)) error + func ReplaceGlobals(logger *Logger) func() + func SecondsDurationEncoder(d time.Duration, enc PrimitiveArrayEncoder) + func ShortCallerEncoder(caller EntryCaller, enc PrimitiveArrayEncoder) + func StringDurationEncoder(d time.Duration, enc PrimitiveArrayEncoder) + type ArrayEncoder interface + AppendArray func(ArrayMarshaler) error + AppendDuration func(time.Duration) + AppendObject func(ObjectMarshaler) error + AppendReflected func(value interface{}) error + AppendTime func(time.Time) + type ArrayMarshaler interface + MarshalLogArray func(ArrayEncoder) error + type ArrayMarshalerFunc func(ArrayEncoder) error + func (f ArrayMarshalerFunc) MarshalLogArray(enc ArrayEncoder) error + type AtomicLevel struct + func NewAtomicLevel() AtomicLevel + func NewAtomicLevelAt(l Level) AtomicLevel + func ParseAtomicLevel(text string) (AtomicLevel, error) + func (lvl *AtomicLevel) UnmarshalText(text []byte) error + func (lvl *AtomicLevel) UnmarshalYAML(value *yaml.Node) error + func (lvl AtomicLevel) Enabled(l Level) bool + func (lvl AtomicLevel) Level() Level + func (lvl AtomicLevel) MarshalText() (text []byte, err error) + func (lvl AtomicLevel) SetLevel(l Level) + func (lvl AtomicLevel) String() string + type AtomicLogger struct + func NewAtomic(logger *Logger) *AtomicLogger + func (l *AtomicLogger) CompareAndSwapLogger(old *Logger, new *Logger) bool + func (l *AtomicLogger) Logger() *Logger + func (l *AtomicLogger) SetLogger(logger *Logger) + func (l *AtomicLogger) SwapLogger(logger *Logger) *Logger + type CallerEncoder func(EntryCaller, PrimitiveArrayEncoder) + func (e *CallerEncoder) UnmarshalText(text []byte) error + type CheckWriteAction uint8 + const WriteThenFatal + const WriteThenGoexit + const WriteThenNoop + const WriteThenPanic + type CheckedEntry struct + ErrorOutput WriteSyncer + func (ce *CheckedEntry) AddCore(ent Entry, core Core) *CheckedEntry + func (ce *CheckedEntry) Should(ent Entry, should CheckWriteAction) *CheckedEntry + func (ce *CheckedEntry) Write(fields ...Field) + type Clock interface + NewTicker func(time.Duration) *time.Ticker + Now func() time.Time + type Config struct + Development bool + DisableCaller bool + DisableStacktrace bool + Encoder Encoder + ErrorOutputPaths []string + InitialFields map[string]interface{} + Level AtomicLevel + OutputPaths []string + Sampling *SamplingConfig + func NewDevelopmentConfig() Config + func NewProductionConfig() Config + func (cfg Config) Build(opts ...Option) (*Logger, error) + type ConsoleEncoderConfig struct + ConsoleSeparator string + DisableCaller bool + DisableFunction bool + DisableLevel bool + DisableName bool + DisableStacktrace bool + DisableTime bool + EncodeCaller CallerEncoder + EncodeDuration DurationEncoder + EncodeLevel LevelEncoder + EncodeName NameEncoder + EncodeTime TimeEncoder + LineEnding string + NewReflectedEncoder func(io.Writer) ReflectedEncoder + SkipLineEnding bool + type Core interface + Check func(Entry, *CheckedEntry) *CheckedEntry + Sync func() error + With func([]Field) Core + Write func(Entry, []Field) error + func NewCore(enc Encoder, ws WriteSyncer, enabler LevelEnabler) Core + func NewIncreaseLevelCore(core Core, level LevelEnabler) (Core, error) + func NewNopCore() Core + func NewSampler(core Core, tick time.Duration, first, thereafter int) Core + func NewSamplerWithOptions(core Core, tick time.Duration, first, thereafter int, opts ...SamplerOption) Core + func RegisterHooks(core Core, hooks ...func(Entry) error) Core + type DurationEncoder func(time.Duration, PrimitiveArrayEncoder) + func (e *DurationEncoder) UnmarshalText(text []byte) error + type Encoder interface + Clone func() Encoder + EncodeEntry func(Entry, []Field) (*bufferpool.Buffer, error) + func NewConsoleEncoder(cfg ConsoleEncoderConfig) Encoder + func NewJSONEncoder(cfg JsonEncoderConfig) Encoder + type Entry struct + Caller EntryCaller + Level Level + LoggerName string + Message string + Stack string + Time time.Time + type EntryCaller struct + Defined bool + File string + Function string + Line int + PC uintptr + func NewEntryCaller(pc uintptr, file string, line int, ok bool) EntryCaller + func (ec EntryCaller) FullPath() string + func (ec EntryCaller) String() string + func (ec EntryCaller) TrimmedPath() string + type Field struct + Integer int64 + Interface interface{} + Key string + String string + Type FieldType + func Any(key string, value interface{}) Field + func Array(key string, val ArrayMarshaler) Field + func Binary(key string, val []byte) Field + func Bool(key string, val bool) Field + func Boolp(key string, val *bool) Field + func Bools(key string, bs []bool) Field + func ByteString(key string, val []byte) Field + func ByteStrings(key string, bss [][]byte) Field + func Complex128(key string, val complex128) Field + func Complex128p(key string, val *complex128) Field + func Complex128s(key string, nums []complex128) Field + func Complex64(key string, val complex64) Field + func Complex64p(key string, val *complex64) Field + func Complex64s(key string, nums []complex64) Field + func Duration(key string, val time.Duration) Field + func Durationp(key string, val *time.Duration) Field + func Durations(key string, ds []time.Duration) Field + func Error(err error) Field + func ErrorFields(err error) []Field + func Errors(key string, errs []error) Field + func Float32(key string, val float32) Field + func Float32p(key string, val *float32) Field + func Float32s(key string, nums []float32) Field + func Float64(key string, val float64) Field + func Float64p(key string, val *float64) Field + func Float64s(key string, nums []float64) Field + func Inline(val ObjectMarshaler) Field + func Int(key string, val int) Field + func Int16(key string, val int16) Field + func Int16p(key string, val *int16) Field + func Int16s(key string, nums []int16) Field + func Int32(key string, val int32) Field + func Int32p(key string, val *int32) Field + func Int32s(key string, nums []int32) Field + func Int64(key string, val int64) Field + func Int64p(key string, val *int64) Field + func Int64s(key string, nums []int64) Field + func Int8(key string, val int8) Field + func Int8p(key string, val *int8) Field + func Int8s(key string, nums []int8) Field + func Intp(key string, val *int) Field + func Ints(key string, nums []int) Field + func NamedError(key string, err error) Field + func Namespace(key string) Field + func Object(key string, val ObjectMarshaler) Field + func Reflect(key string, val interface{}) Field + func Skip() Field + func Stack(key string) Field + func StackSkip(key string, skip int) Field + func String(key string, val string) Field + func Stringer(key string, val fmt.Stringer) Field + func Stringp(key string, val *string) Field + func Strings(key string, ss []string) Field + func Time(key string, val time.Time) Field + func Timep(key string, val *time.Time) Field + func Times(key string, ts []time.Time) Field + func Uint(key string, val uint) Field + func Uint16(key string, val uint16) Field + func Uint16p(key string, val *uint16) Field + func Uint16s(key string, nums []uint16) Field + func Uint32(key string, val uint32) Field + func Uint32p(key string, val *uint32) Field + func Uint32s(key string, nums []uint32) Field + func Uint64(key string, val uint64) Field + func Uint64p(key string, val *uint64) Field + func Uint64s(key string, nums []uint64) Field + func Uint8(key string, val uint8) Field + func Uint8p(key string, val *uint8) Field + func Uint8s(key string, nums []uint8) Field + func Uintp(key string, val *uint) Field + func Uintptr(key string, val uintptr) Field + func Uintptrp(key string, val *uintptr) Field + func Uintptrs(key string, us []uintptr) Field + func Uints(key string, nums []uint) Field + func (f Field) AddTo(enc ObjectEncoder) + func (f Field) Equals(other Field) bool + type FieldType uint8 + const ArrayMarshalerType + const BinaryType + const BoolType + const ByteStringType + const Complex128Type + const Complex64Type + const DurationType + const ErrorType + const Float32Type + const Float64Type + const InlineMarshalerType + const Int16Type + const Int32Type + const Int64Type + const Int8Type + const NamespaceType + const ObjectMarshalerType + const ReflectType + const SkipType + const StringType + const StringerType + const TimeFullType + const TimeType + const Uint16Type + const Uint32Type + const Uint64Type + const Uint8Type + const UintptrType + const UnknownType + type FieldsError struct + func NewFieldsError(err error, fields ...Field) FieldsError + func (e FieldsError) AddFields(fields ...Field) FieldsError + func (e FieldsError) Fields() []Field + func (e FieldsError) GetField(key string) Field + type JsonEncoderConfig struct + CallerKey string + EncodeCaller CallerEncoder + EncodeDuration DurationEncoder + EncodeLevel LevelEncoder + EncodeName NameEncoder + EncodeTime TimeEncoder + EscapeESC bool + FunctionKey string + LevelKey string + LineEnding string + MessageKey string + NameKey string + NewReflectedEncoder func(io.Writer) ReflectedEncoder + SkipLineEnding bool + StacktraceKey string + TimeKey string + func NewDevelopmentJsonEncoderConfig() JsonEncoderConfig + func NewProductionJsonEncoderConfig() JsonEncoderConfig + type Level int8 + const DPanicLevel + const DebugLevel + const ErrorLevel + const FatalLevel + const InfoLevel + const PanicLevel + const WarnLevel + func LevelFlag(name string, defaultLevel Level, usage string) *Level + func ParseLevel(text string) (Level, error) + func (l *Level) Get() interface{} + func (l *Level) Set(s string) error + func (l *Level) UnmarshalText(text []byte) error + func (l Level) CapitalString() string + func (l Level) Enabled(lvl Level) bool + func (l Level) MarshalText() ([]byte, error) + func (l Level) String() string + type LevelEnabler interface + Enabled func(Level) bool + type LevelEnablerFunc func(Level) bool + func (f LevelEnablerFunc) Enabled(lvl Level) bool + type LevelEncoder func(Level, PrimitiveArrayEncoder) + func (e *LevelEncoder) UnmarshalText(text []byte) error + type LogFields interface + Fields func() []Field + type Logger struct + func L() *Logger + func New(core Core, options ...Option) *Logger + func NewDevelopment(options ...Option) (*Logger, error) + func NewExample(options ...Option) *Logger + func NewNop() *Logger + func NewProduction(options ...Option) (*Logger, error) + func (log *Logger) Check(lvl Level, msg string) *CheckedEntry + func (log *Logger) Core() Core + func (log *Logger) DPanic(msg string, fields ...Field) + func (log *Logger) Debug(msg string, fields ...Field) + func (log *Logger) Error(msg string, fields ...Field) + func (log *Logger) ErrorMsg(err string, fields ...Field) error + func (log *Logger) ErrorWith(msg string, err error, fields ...Field) error + func (log *Logger) Fatal(msg string, fields ...Field) + func (log *Logger) Info(msg string, fields ...Field) + func (log *Logger) Named(name string) *Logger + func (log *Logger) Panic(msg string, fields ...Field) + func (log *Logger) SubNamed(name string) *Logger + func (log *Logger) Sugar() *SugaredLogger + func (log *Logger) Sync() error + func (log *Logger) Warn(msg string, fields ...Field) + func (log *Logger) With(fields ...Field) *Logger + func (log *Logger) WithOptions(opts ...Option) *Logger + type LoggerProvider interface + CompareAndSwapLogger func(old *Logger, new *Logger) bool + Logger func() *Logger + SetLogger func(logger *Logger) + SwapLogger func(logger *Logger) *Logger + type MapObjectEncoder struct + Fields map[string]interface{} + func NewMapObjectEncoder() *MapObjectEncoder + func (m *MapObjectEncoder) AddArray(key string, v ArrayMarshaler) error + func (m *MapObjectEncoder) AddBinary(k string, v []byte) + func (m *MapObjectEncoder) AddBool(k string, v bool) + func (m *MapObjectEncoder) AddByteString(k string, v []byte) + func (m *MapObjectEncoder) AddComplex128(k string, v complex128) + func (m *MapObjectEncoder) AddComplex64(k string, v complex64) + func (m *MapObjectEncoder) AddFloat32(k string, v float32) + func (m *MapObjectEncoder) AddFloat64(k string, v float64) + func (m *MapObjectEncoder) AddInt(k string, v int) + func (m *MapObjectEncoder) AddInt16(k string, v int16) + func (m *MapObjectEncoder) AddInt32(k string, v int32) + func (m *MapObjectEncoder) AddInt64(k string, v int64) + func (m *MapObjectEncoder) AddInt8(k string, v int8) + func (m *MapObjectEncoder) AddObject(k string, v ObjectMarshaler) error + func (m *MapObjectEncoder) AddReflected(k string, v interface{}) error + func (m *MapObjectEncoder) AddString(k string, v string) + func (m *MapObjectEncoder) AddUint(k string, v uint) + func (m *MapObjectEncoder) AddUint16(k string, v uint16) + func (m *MapObjectEncoder) AddUint32(k string, v uint32) + func (m *MapObjectEncoder) AddUint64(k string, v uint64) + func (m *MapObjectEncoder) AddUint8(k string, v uint8) + func (m *MapObjectEncoder) AddUintptr(k string, v uintptr) + func (m *MapObjectEncoder) OpenNamespace(k string) + func (m MapObjectEncoder) AddDuration(k string, v time.Duration) + func (m MapObjectEncoder) AddTime(k string, v time.Time) + type NameEncoder func(string, PrimitiveArrayEncoder) + func (e *NameEncoder) UnmarshalText(text []byte) error + type ObjectEncoder interface + AddArray func(key string, marshaler ArrayMarshaler) error + AddBinary func(key string, value []byte) + AddBool func(key string, value bool) + AddByteString func(key string, value []byte) + AddComplex128 func(key string, value complex128) + AddComplex64 func(key string, value complex64) + AddDuration func(key string, value time.Duration) + AddFloat32 func(key string, value float32) + AddFloat64 func(key string, value float64) + AddInt func(key string, value int) + AddInt16 func(key string, value int16) + AddInt32 func(key string, value int32) + AddInt64 func(key string, value int64) + AddInt8 func(key string, value int8) + AddObject func(key string, marshaler ObjectMarshaler) error + AddReflected func(key string, value interface{}) error + AddString func(key, value string) + AddTime func(key string, value time.Time) + AddUint func(key string, value uint) + AddUint16 func(key string, value uint16) + AddUint32 func(key string, value uint32) + AddUint64 func(key string, value uint64) + AddUint8 func(key string, value uint8) + AddUintptr func(key string, value uintptr) + OpenNamespace func(key string) + type ObjectMarshaler interface + MarshalLogObject func(ObjectEncoder) error + type ObjectMarshalerFunc func(ObjectEncoder) error + func (f ObjectMarshalerFunc) MarshalLogObject(enc ObjectEncoder) error + type Option interface + func AddCaller() Option + func AddCallerSkip(skip int) Option + func AddStacktrace(lvl LevelEnabler) Option + func AddSubName(name string) Option + func Development() Option + func ErrorOutput(w WriteSyncer) Option + func Fields(fs ...Field) Option + func Hooks(hooks ...func(Entry) error) Option + func IncreaseLevel(lvl LevelEnabler) Option + func OnFatal(action CheckWriteAction) Option + func WithCaller(enabled bool) Option + func WithClock(clock Clock) Option + func WithName(name string) Option + func WrapCore(f func(Core) Core) Option + type PrimitiveArrayEncoder interface + AppendBool func(bool) + AppendByteString func([]byte) + AppendComplex128 func(complex128) + AppendComplex64 func(complex64) + AppendFloat32 func(float32) + AppendFloat64 func(float64) + AppendInt func(int) + AppendInt16 func(int16) + AppendInt32 func(int32) + AppendInt64 func(int64) + AppendInt8 func(int8) + AppendString func(string) + AppendUint func(uint) + AppendUint16 func(uint16) + AppendUint32 func(uint32) + AppendUint64 func(uint64) + AppendUint8 func(uint8) + AppendUintptr func(uintptr) + type ReflectedEncoder interface + Encode func(interface{}) error + type SamplerOption interface + func SamplerHook(hook func(entry Entry, dec SamplingDecision)) SamplerOption + type SamplerOptionFunc func(*sampler) + type SamplingConfig struct + Hook func(Entry, SamplingDecision) + Initial int + Thereafter int + type SamplingDecision uint32 + const LogDropped + const LogSampled + type Sink interface + type SugaredLogger struct + func S() *SugaredLogger + func (s *SugaredLogger) DPanic(args ...interface{}) + func (s *SugaredLogger) DPanicf(template string, args ...interface{}) + func (s *SugaredLogger) DPanicw(msg string, keysAndValues ...interface{}) + func (s *SugaredLogger) Debug(args ...interface{}) + func (s *SugaredLogger) Debugf(template string, args ...interface{}) + func (s *SugaredLogger) Debugw(msg string, keysAndValues ...interface{}) + func (s *SugaredLogger) Desugar() *Logger + func (s *SugaredLogger) Error(args ...interface{}) + func (s *SugaredLogger) Errorf(template string, args ...interface{}) + func (s *SugaredLogger) Errorw(msg string, keysAndValues ...interface{}) + func (s *SugaredLogger) Fatal(args ...interface{}) + func (s *SugaredLogger) Fatalf(template string, args ...interface{}) + func (s *SugaredLogger) Fatalw(msg string, keysAndValues ...interface{}) + func (s *SugaredLogger) Info(args ...interface{}) + func (s *SugaredLogger) Infof(template string, args ...interface{}) + func (s *SugaredLogger) Infow(msg string, keysAndValues ...interface{}) + func (s *SugaredLogger) Named(name string) *SugaredLogger + func (s *SugaredLogger) Panic(args ...interface{}) + func (s *SugaredLogger) Panicf(template string, args ...interface{}) + func (s *SugaredLogger) Panicw(msg string, keysAndValues ...interface{}) + func (s *SugaredLogger) Sync() error + func (s *SugaredLogger) Warn(args ...interface{}) + func (s *SugaredLogger) Warnf(template string, args ...interface{}) + func (s *SugaredLogger) Warnw(msg string, keysAndValues ...interface{}) + func (s *SugaredLogger) With(args ...interface{}) *SugaredLogger + type TimeEncoder func(time.Time, PrimitiveArrayEncoder) + func TimeEncoderOfLayout(layout string) TimeEncoder + func (e *TimeEncoder) UnmarshalText(text []byte) error + func (e *TimeEncoder) UnmarshalYAML(value *yaml.Node) error + type WriteSyncer interface + Sync func() error + func AddSync(w io.Writer) WriteSyncer + func CombineWriteSyncers(writers ...WriteSyncer) WriteSyncer + func Lock(ws WriteSyncer) WriteSyncer + func NewMultiWriteSyncer(ws ...WriteSyncer) WriteSyncer + func Open(paths ...string) (WriteSyncer, func(), error)