Versions in this module Expand all Collapse all v2 v2.0.0 Oct 28, 2020 Changes in this version + const DefaultFieldKeyCaller + const DefaultFieldKeyLevel + const DefaultFieldKeyMsg + const DefaultFieldKeyName + const DefaultFieldKeyTime + const PageSize + var NewChannelWriter = channelWriterGetter(func(cfg ChannelWriterConfig) (EntryWriter, ChannelWriterCloseFunc) { ... }) + var NewErrorEncoder = errorEncoderGetter(func(c ErrorEncoderConfig) ErrorEncoder { ... }) + var NewJSONEncoder = jsonEncoderGetter(func(cfg JSONEncoderConfig) Encoder { ... }) + var NewJSONTypeEncoderFactory = jsonTypeEncoderFactoryGetter(func(c JSONEncoderConfig) TypeEncoderFactory { ... }) + func AppendBool(b *Buffer, n bool) + func AppendFloat32(b *Buffer, n float32) + func AppendFloat64(b *Buffer, n float64) + func AppendInt(b *Buffer, n int64) + func AppendUint(b *Buffer, n uint64) + func DefaultErrorEncoder(key string, err error, enc FieldEncoder) + func DefaultLevelEncoder(lvl Level, m TypeEncoder) + func EscapeByteString(buf *Buffer, s []byte) error + func EscapeString(buf *Buffer, s string) error + func FloatSecondsDurationEncoder(d time.Duration, e TypeEncoder) + func FullCallerEncoder(c EntryCaller, m TypeEncoder) + func NanoDurationEncoder(d time.Duration, e TypeEncoder) + func NewContext(parent context.Context, logger *Logger) context.Context + func RFC3339NanoTimeEncoder(t time.Time, e TypeEncoder) + func RFC3339TimeEncoder(t time.Time, e TypeEncoder) + func ShortCallerEncoder(c EntryCaller, m TypeEncoder) + func StringDurationEncoder(d time.Duration, m TypeEncoder) + func UnixNanoTimeEncoder(t time.Time, e TypeEncoder) + func UpperCaseLevelEncoder(lvl Level, m TypeEncoder) + type Appender interface + Append func(Entry) error + Flush func() error + Sync func() error + func NewDiscardAppender() Appender + func NewWriteAppender(w io.Writer, enc Encoder) Appender + type ArrayEncoder interface + EncodeLogfArray func(TypeEncoder) error + type Buffer struct + Data []byte + func NewBuffer() *Buffer + func NewBufferWithCapacity(capacity int) *Buffer + func (b *Buffer) AppendByte(data byte) + func (b *Buffer) AppendBytes(data []byte) + func (b *Buffer) AppendString(data string) + func (b *Buffer) Back() byte + func (b *Buffer) Bytes() []byte + func (b *Buffer) Cap() int + func (b *Buffer) EnsureSize(s int) []byte + func (b *Buffer) ExtendBytes(s int) []byte + func (b *Buffer) Len() int + func (b *Buffer) Reset() + func (b *Buffer) String() string + func (b *Buffer) Write(p []byte) (n int, err error) + type Cache struct + func NewCache(limit int) *Cache + func (c *Cache) Clean() + func (c *Cache) Get(k int32) ([]byte, bool) + func (c *Cache) Len() int + func (c *Cache) Set(k int32, bytes []byte) + type CallerEncoder func(EntryCaller, TypeEncoder) + type ChannelWriterCloseFunc func() + type ChannelWriterConfig struct + Appender Appender + Capacity int + EnableSyncOnError bool + ErrorAppender Appender + func (c ChannelWriterConfig) WithDefaults() ChannelWriterConfig + type DurationEncoder func(time.Duration, TypeEncoder) + type Encoder interface + Encode func(*Buffer, Entry) error + type Entry struct + Caller EntryCaller + DerivedFields []Field + Fields []Field + Level Level + LoggerID int32 + LoggerName string + Text string + Time time.Time + type EntryCaller struct + File string + Line int + PC uintptr + Specified bool + func NewEntryCaller(skip int) EntryCaller + func (c EntryCaller) FileWithPackage() string + type EntryWriter interface + WriteEntry func(Entry) + func NewUnbufferedEntryWriter(appender Appender) EntryWriter + type ErrorEncoder func(string, error, FieldEncoder) + type ErrorEncoderConfig struct + NoVerboseField bool + VerboseFieldSuffix string + func (c ErrorEncoderConfig) WithDefaults() ErrorEncoderConfig + type Field struct + Any interface{} + Bytes []byte + Int int64 + Key string + Type FieldType + func Any(k string, v interface{}) Field + func Array(k string, v ArrayEncoder) Field + func Bool(k string, v bool) Field + func Bools(k string, v []bool) Field + func Bytes(k string, v []byte) Field + func ConstBools(k string, v []bool) Field + func ConstBytes(k string, v []byte) Field + func ConstDurations(k string, v []time.Duration) Field + func ConstFloats32(k string, v []float32) Field + func ConstFloats64(k string, v []float64) Field + func ConstFormatter(k string, verb string, v interface{}) Field + func ConstFormatterV(k string, v interface{}) Field + func ConstInts(k string, v []int) Field + func ConstInts16(k string, v []int16) Field + func ConstInts32(k string, v []int32) Field + func ConstInts64(k string, v []int64) Field + func ConstInts8(k string, v []int8) Field + func ConstStringer(k string, v fmt.Stringer) Field + func ConstUints(k string, v []uint) Field + func ConstUints16(k string, v []uint16) Field + func ConstUints32(k string, v []uint32) Field + func ConstUints64(k string, v []uint64) Field + func ConstUints8(k string, v []uint8) Field + func Duration(k string, v time.Duration) Field + func Durations(k string, v []time.Duration) Field + func Error(v error) Field + func Float32(k string, v float32) Field + func Float64(k string, v float64) Field + func Floats32(k string, v []float32) Field + func Floats64(k string, v []float64) Field + func Formatter(k string, verb string, v interface{}) Field + func FormatterV(k string, v interface{}) Field + func Int(k string, v int) Field + func Int16(k string, v int16) Field + func Int32(k string, v int32) Field + func Int64(k string, v int64) Field + func Int8(k string, v int8) Field + func Ints(k string, v []int) Field + func Ints16(k string, v []int16) Field + func Ints32(k string, v []int32) Field + func Ints64(k string, v []int64) Field + func Ints8(k string, v []int8) Field + func NamedError(k string, v error) Field + func Object(k string, v ObjectEncoder) Field + func String(k string, v string) Field + func Stringer(k string, v fmt.Stringer) Field + func Strings(k string, v []string) Field + func Time(k string, v time.Time) Field + func Uint(k string, v uint) Field + func Uint16(k string, v uint16) Field + func Uint32(k string, v uint32) Field + func Uint64(k string, v uint64) Field + func Uint8(k string, v uint8) Field + func Uints(k string, v []uint) Field + func Uints16(k string, v []uint16) Field + func Uints32(k string, v []uint32) Field + func Uints64(k string, v []uint64) Field + func Uints8(k string, v []uint8) Field + func (fd Field) Accept(v FieldEncoder) + type FieldEncoder interface + EncodeFieldAny func(string, interface{}) + EncodeFieldArray func(string, ArrayEncoder) + EncodeFieldBool func(string, bool) + EncodeFieldBools func(string, []bool) + EncodeFieldBytes func(string, []byte) + EncodeFieldDuration func(string, time.Duration) + EncodeFieldDurations func(string, []time.Duration) + EncodeFieldError func(string, error) + EncodeFieldFloat32 func(string, float32) + EncodeFieldFloat64 func(string, float64) + EncodeFieldFloats32 func(string, []float32) + EncodeFieldFloats64 func(string, []float64) + EncodeFieldInt16 func(string, int16) + EncodeFieldInt32 func(string, int32) + EncodeFieldInt64 func(string, int64) + EncodeFieldInt8 func(string, int8) + EncodeFieldInts16 func(string, []int16) + EncodeFieldInts32 func(string, []int32) + EncodeFieldInts64 func(string, []int64) + EncodeFieldInts8 func(string, []int8) + EncodeFieldObject func(string, ObjectEncoder) + EncodeFieldString func(string, string) + EncodeFieldTime func(string, time.Time) + EncodeFieldUint16 func(string, uint16) + EncodeFieldUint32 func(string, uint32) + EncodeFieldUint64 func(string, uint64) + EncodeFieldUint8 func(string, uint8) + EncodeFieldUints16 func(string, []uint16) + EncodeFieldUints32 func(string, []uint32) + EncodeFieldUints64 func(string, []uint64) + EncodeFieldUints8 func(string, []uint8) + type FieldType byte + const FieldTypeAny + const FieldTypeArray + const FieldTypeBool + const FieldTypeBytes + const FieldTypeBytesToBools + const FieldTypeBytesToDurations + const FieldTypeBytesToFloats32 + const FieldTypeBytesToFloats64 + const FieldTypeBytesToInts16 + const FieldTypeBytesToInts32 + const FieldTypeBytesToInts64 + const FieldTypeBytesToInts8 + const FieldTypeBytesToString + const FieldTypeBytesToUints16 + const FieldTypeBytesToUints32 + const FieldTypeBytesToUints64 + const FieldTypeBytesToUints8 + const FieldTypeDuration + const FieldTypeError + const FieldTypeFloat32 + const FieldTypeFloat64 + const FieldTypeFormatter + const FieldTypeInt16 + const FieldTypeInt32 + const FieldTypeInt64 + const FieldTypeInt8 + const FieldTypeObject + const FieldTypeRawBytes + const FieldTypeRawBytesToBools + const FieldTypeRawBytesToDurations + const FieldTypeRawBytesToFloats32 + const FieldTypeRawBytesToFloats64 + const FieldTypeRawBytesToInts16 + const FieldTypeRawBytesToInts32 + const FieldTypeRawBytesToInts64 + const FieldTypeRawBytesToInts8 + const FieldTypeRawBytesToUints16 + const FieldTypeRawBytesToUints32 + const FieldTypeRawBytesToUints64 + const FieldTypeRawBytesToUints8 + const FieldTypeRawMask + const FieldTypeStringer + const FieldTypeTime + const FieldTypeUint16 + const FieldTypeUint32 + const FieldTypeUint64 + const FieldTypeUint8 + const FieldTypeUnknown + type JSONEncoderConfig struct + DisableFieldCaller bool + DisableFieldLevel bool + DisableFieldMsg bool + DisableFieldName bool + DisableFieldTime bool + EncodeCaller CallerEncoder + EncodeDuration DurationEncoder + EncodeError ErrorEncoder + EncodeLevel LevelEncoder + EncodeTime TimeEncoder + FieldKeyCaller string + FieldKeyLevel string + FieldKeyMsg string + FieldKeyName string + FieldKeyTime string + func (c JSONEncoderConfig) WithDefaults() JSONEncoderConfig + type Level int8 + const LevelDebug + const LevelError + const LevelInfo + const LevelWarn + func LevelFromString(lvl string) (Level, bool) + func (l Level) Checker() LevelChecker + func (l Level) Enabled(o Level) bool + func (l Level) LevelChecker() LevelChecker + func (l Level) String() string + func (l Level) UpperCaseString() string + type LevelChecker func(Level) bool + type LevelCheckerGetter interface + LevelChecker func() LevelChecker + type LevelCheckerGetterFunc func() LevelChecker + func (fn LevelCheckerGetterFunc) LevelChecker() LevelChecker + type LevelEncoder func(Level, TypeEncoder) + type LogFunc func(string, ...Field) + type Logger struct + func DisabledLogger() *Logger + func FromContext(ctx context.Context) *Logger + func NewDisabledLogger() *Logger + func NewLogger(level LevelCheckerGetter, w EntryWriter) *Logger + func (l *Logger) AtLevel(lvl Level, fn func(LogFunc)) + func (l *Logger) Debug(text string, fs ...Field) + func (l *Logger) Error(text string, fs ...Field) + func (l *Logger) Info(text string, fs ...Field) + func (l *Logger) Warn(text string, fs ...Field) + func (l *Logger) With(fs ...Field) *Logger + func (l *Logger) WithCaller() *Logger + func (l *Logger) WithCallerSkip(skip int) *Logger + func (l *Logger) WithName(n string) *Logger + type MutableLevel struct + func NewMutableLevel(l Level) *MutableLevel + func (l *MutableLevel) Checker() LevelChecker + func (l *MutableLevel) Level() Level + func (l *MutableLevel) LevelChecker() LevelChecker + func (l *MutableLevel) Set(o Level) + type ObjectEncoder interface + EncodeLogfObject func(FieldEncoder) error + type Snapshotter interface + TakeSnapshot func() interface{} + type TimeEncoder func(time.Time, TypeEncoder) + func LayoutTimeEncoder(layout string) TimeEncoder + type TypeEncoder interface + EncodeTypeAny func(interface{}) + EncodeTypeArray func(ArrayEncoder) + EncodeTypeBool func(bool) + EncodeTypeBools func([]bool) + EncodeTypeBytes func([]byte) + EncodeTypeDuration func(time.Duration) + EncodeTypeDurations func([]time.Duration) + EncodeTypeFloat32 func(float32) + EncodeTypeFloat64 func(float64) + EncodeTypeFloats32 func([]float32) + EncodeTypeFloats64 func([]float64) + EncodeTypeInt16 func(int16) + EncodeTypeInt32 func(int32) + EncodeTypeInt64 func(int64) + EncodeTypeInt8 func(int8) + EncodeTypeInts16 func([]int16) + EncodeTypeInts32 func([]int32) + EncodeTypeInts64 func([]int64) + EncodeTypeInts8 func([]int8) + EncodeTypeObject func(ObjectEncoder) + EncodeTypeString func(string) + EncodeTypeTime func(time.Time) + EncodeTypeUint16 func(uint16) + EncodeTypeUint32 func(uint32) + EncodeTypeUint64 func(uint64) + EncodeTypeUint8 func(uint8) + EncodeTypeUints16 func([]uint16) + EncodeTypeUints32 func([]uint32) + EncodeTypeUints64 func([]uint64) + EncodeTypeUints8 func([]uint8) + EncodeTypeUnsafeBytes func(unsafe.Pointer) + type TypeEncoderFactory interface + TypeEncoder func(*Buffer) TypeEncoder Other modules containing this package github.com/ssgreg/logf