Documentation
¶
Index ¶
- Variables
- func Any(key string, value interface{}) zapcore.Field
- func Array(key string, val zapcore.ArrayMarshaler) zapcore.Field
- func Binary(key string, val []byte) zapcore.Field
- func Bool(key string, val bool) zapcore.Field
- func Bools(key string, bs []bool) zapcore.Field
- func ByteString(key string, val []byte) zapcore.Field
- func ByteStrings(key string, bss [][]byte) zapcore.Field
- func CheckErr(msg string, err error, fields ...zapcore.Field)
- func CheckErrCtx(ctx context.Context, msg string, err error, fields ...zapcore.Field)
- func Complex128(key string, val complex128) zapcore.Field
- func Complex128s(key string, nums []complex128) zapcore.Field
- func Complex64(key string, val complex64) zapcore.Field
- func Complex64s(key string, nums []complex64) zapcore.Field
- func Duration(key string, val time.Duration) zapcore.Field
- func Durations(key string, ds []time.Duration) zapcore.Field
- func Error(err error) zapcore.Field
- func Errors(key string, errs []error) zapcore.Field
- func Float32(key string, val float32) zapcore.Field
- func Float32s(key string, nums []float32) zapcore.Field
- func Float64(key string, val float64) zapcore.Field
- func Float64s(key string, nums []float64) zapcore.Field
- func Int(key string, val int) zapcore.Field
- func Int16(key string, val int16) zapcore.Field
- func Int16s(key string, nums []int16) zapcore.Field
- func Int32(key string, val int32) zapcore.Field
- func Int32s(key string, nums []int32) zapcore.Field
- func Int64(key string, val int64) zapcore.Field
- func Int64s(key string, nums []int64) zapcore.Field
- func Int8(key string, val int8) zapcore.Field
- func Int8s(key string, nums []int8) zapcore.Field
- func Ints(key string, nums []int) zapcore.Field
- func NamedError(key string, err error) zapcore.Field
- func Namespace(key string) zapcore.Field
- func Object(key string, val zapcore.ObjectMarshaler) zapcore.Field
- func Reflect(key string, val interface{}) zapcore.Field
- func SafeClose(c io.Closer, msg string, fields ...zapcore.Field)
- func SafeCloseCtx(ctx context.Context, c io.Closer, msg string, fields ...zapcore.Field)
- func SetLoggerFactory(instance LoggerFactory)
- func Setup(ctx context.Context, opts Options) zap.AtomicLevel
- func Skip() zapcore.Field
- func Stack(key string) zapcore.Field
- func String(key string, val string) zapcore.Field
- func Stringer(key string, val fmt.Stringer) zapcore.Field
- func Strings(key string, ss []string) zapcore.Field
- func Time(key string, val time.Time) zapcore.Field
- func Times(key string, ts []time.Time) zapcore.Field
- func Uint(key string, val uint) zapcore.Field
- func Uint16(key string, val uint16) zapcore.Field
- func Uint16s(key string, nums []uint16) zapcore.Field
- func Uint32(key string, val uint32) zapcore.Field
- func Uint32s(key string, nums []uint32) zapcore.Field
- func Uint64(key string, val uint64) zapcore.Field
- func Uint64s(key string, nums []uint64) zapcore.Field
- func Uint8(key string, val uint8) zapcore.Field
- func Uint8s(key string, nums []uint8) zapcore.Field
- func Uintptr(key string, val uintptr) zapcore.Field
- func Uintptrs(key string, us []uintptr) zapcore.Field
- func Uints(key string, nums []uint) zapcore.Field
- type Logger
- type LoggerFactory
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOptions = &Options{ Debug: false, LogLevel: "info", AppName: "changeme", AppID: "changeme", Version: "0.0.1", Revision: "123456789", DisableFields: false, }
DefaultOptions defines default logger options
Functions ¶
func ByteStrings ¶
ByteStrings type wrapper
func CheckErrCtx ¶
CheckErrCtx handles error correctly
func Complex128s ¶
func Complex128s(key string, nums []complex128) zapcore.Field
Complex128s type wrapper
func Complex64s ¶
Complex64s type wrapper
func Object ¶
func Object(key string, val zapcore.ObjectMarshaler) zapcore.Field
Object type wrapper
func SafeCloseCtx ¶
SafeCloseCtx handles the closer error
func SetLoggerFactory ¶
func SetLoggerFactory(instance LoggerFactory)
SetLoggerFactory defines the default package logger
Types ¶
type Logger ¶
type Logger interface { Debug(msg string, fields ...zapcore.Field) Info(msg string, fields ...zapcore.Field) Warn(msg string, fields ...zapcore.Field) Error(msg string, fields ...zapcore.Field) Fatal(msg string, fields ...zapcore.Field) With(fields ...zapcore.Field) Logger Debugf(msg string, args ...interface{}) Infof(msg string, args ...interface{}) Warnf(msg string, args ...interface{}) Errorf(msg string, args ...interface{}) Fatalf(msg string, args ...interface{}) }
Logger is a simplified abstraction of the zap.Logger
type LoggerFactory ¶
type LoggerFactory interface { Name() string Bg() Logger For(context.Context) Logger With(...zapcore.Field) LoggerFactory }
LoggerFactory defines logger factory contract
func NewFactory ¶
func NewFactory(logger *zap.Logger) LoggerFactory
NewFactory creates a new Factory.
Click to show internal directories.
Click to hide internal directories.