log

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(ctx context.Context, msg string, fields ...Field)

func DebugEnabled

func DebugEnabled(ctx context.Context) bool

func Err

func Err(ctx context.Context, msg string, fields ...Field)

func ErrorEnabled

func ErrorEnabled(ctx context.Context) bool

func Fatal

func Fatal(ctx context.Context, msg string, fields ...Field)

func Handler

func Handler(l *Log) func(http.Handler) http.Handler

Handler for log to context injecting.

func Info

func Info(ctx context.Context, msg string, fields ...Field)

func InfoEnabled

func InfoEnabled(ctx context.Context) bool

func MillisecondDurationEncoder

func MillisecondDurationEncoder(d time.Duration, enc zapcore.PrimitiveArrayEncoder)

SecondsDurationEncoder serializes a time.Duration to a floating-point number of seconds elapsed.

func NewConfig

func NewConfig() zap.Config

func NewEncoderConfig

func NewEncoderConfig() zapcore.EncoderConfig

func UTCTimeEncoder

func UTCTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)

func Warn

func Warn(ctx context.Context, msg string, fields ...Field)

func WarnEnabled

func WarnEnabled(ctx context.Context) bool

func WithFields

func WithFields(ctx context.Context, fields ...Field) context.Context

Types

type Field

type Field struct {
	// contains filtered or unexported fields
}

func Any

func Any(key string, val interface{}) Field

func Binary

func Binary(key string, val []byte) Field

func Bool

func Bool(key string, val bool) Field

func Boolp

func Boolp(key string, val *bool) Field

func Bools

func Bools(key string, bb []bool) Field

func ByteString

func ByteString(key string, val []byte) Field

func Duration

func Duration(key string, val time.Duration) Field

func Durationp

func Durationp(key string, val *time.Duration) Field

func Error

func Error(err error) Field

func Errors

func Errors(key string, errs []error) Field

func Float32

func Float32(key string, val float32) Field

func Float32p

func Float32p(key string, val *float32) Field

func Float64

func Float64(key string, val float64) Field

func Float64p

func Float64p(key string, val *float64) Field

func Int

func Int(key string, val int) Field

func Int16

func Int16(key string, val int16) Field

func Int16p

func Int16p(key string, val *int16) Field

func Int16s

func Int16s(key string, ints []int16) Field

func Int32

func Int32(key string, val int32) Field

func Int32p

func Int32p(key string, val *int32) Field

func Int32s

func Int32s(key string, ints []int32) Field

func Int64

func Int64(key string, val int64) Field

func Int64s

func Int64s(key string, ints []int64) Field

func Int8

func Int8(key string, val int8) Field

func Int8p

func Int8p(key string, val *int8) Field

func Int8s

func Int8s(key string, ints []int8) Field

func Intp

func Intp(key string, val *int) Field

func Ints

func Ints(key string, ints []int) Field

func NamedError

func NamedError(key string, err error) Field

func Object

func Object(key string, m zapcore.ObjectMarshaler) Field

func Reflect

func Reflect(key string, val interface{}) Field

func Skip

func Skip() Field

func Stack

func Stack(key string) Field

func String

func String(key, val string) Field

func Stringer

func Stringer(key string, val fmt.Stringer) Field

func Stringp

func Stringp(key string, val *string) Field

func Strings

func Strings(key string, ss []string) Field

func Time

func Time(key string, val time.Time) Field

func Timep

func Timep(key string, val *time.Time) Field

func Times

func Times(key string, ts []time.Time) Field

func UInt16s

func UInt16s(key string, ints []uint16) Field

func UInt32s

func UInt32s(key string, ints []uint32) Field

func UInt64s

func UInt64s(key string, ints []uint64) Field

func UInt8s

func UInt8s(key string, ints []uint8) Field

func UInts

func UInts(key string, ints []uint) Field

func Uint

func Uint(key string, val uint) Field

func Uint16

func Uint16(key string, val uint16) Field

func Uint32

func Uint32(key string, val uint32) Field

func Uint32p

func Uint32p(key string, val *uint32) Field

func Uint64

func Uint64(key string, val uint64) Field

func Uint64p

func Uint64p(key string, val *uint64) Field

func Uint8

func Uint8(key string, val uint8) Field

func Uint8p

func Uint8p(key string, val *uint8) Field

func Uintp

func Uintp(key string, val *uint) Field

func (Field) GetKey

func (f Field) GetKey() string

type Log

type Log struct {
	// contains filtered or unexported fields
}

func FromContext

func FromContext(ctx context.Context) *Log

Returns logger from context.

func New

func New(debug bool, fields ...Field) *Log

func Nop

func Nop() *Log

func (*Log) Close

func (l *Log) Close()

func (*Log) Debug

func (l *Log) Debug(msg string, fields ...Field)

func (*Log) DebugEnabled

func (l *Log) DebugEnabled() bool

func (*Log) Error

func (l *Log) Error(msg string, fields ...Field)

func (*Log) ErrorEnabled

func (l *Log) ErrorEnabled() bool

func (*Log) Fatal

func (l *Log) Fatal(msg string, fields ...Field)

func (*Log) Info

func (l *Log) Info(msg string, fields ...Field)

func (*Log) InfoEnabled

func (l *Log) InfoEnabled() bool

func (*Log) Inject

func (l *Log) Inject(ctx context.Context) context.Context

Inject logger to context and returns new context.

func (*Log) Named

func (l *Log) Named(s string) *Log

func (*Log) Warn

func (l *Log) Warn(msg string, fields ...Field)

func (*Log) WarnEnabled

func (l *Log) WarnEnabled() bool

func (*Log) With

func (l *Log) With(fields ...Field) *Log

func (*Log) WithCallerSkip

func (l *Log) WithCallerSkip(skip int) *Log

func (*Log) Z

func (l *Log) Z() *zap.Logger

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL