Documentation
¶
Index ¶
- Constants
- func DPanic(args ...any)
- func DPanicf(template string, args ...any)
- func Debug(args ...any)
- func Debugf(template string, args ...any)
- func Enabled(lvl Level) bool
- func Error(args ...any)
- func Errorf(template string, args ...any)
- func Fatal(args ...any)
- func Fatalf(template string, args ...any)
- func Info(args ...any)
- func Infof(template string, args ...any)
- func Logger() *zap.Logger
- func Panic(args ...any)
- func Panicf(template string, args ...any)
- func ReplaceGlobals(logger *Log)
- func SetLevelWithText(text string) error
- func Sugar() *zap.SugaredLogger
- func Sync() error
- func V(lvl Level) bool
- func Warn(args ...any)
- func Warnf(template string, args ...any)
- type ArrayEncoder
- type ArrayMarshaler
- type AtomicLevel
- type CallerCore
- func (c *CallerCore) AddSkip(callerSkip int) *CallerCore
- func (c *CallerCore) AddSkipPackage(vs ...string) *CallerCore
- func (c *CallerCore) Enabled(lvl Level) bool
- func (c *CallerCore) Level() Level
- func (c *CallerCore) SetLevel(lv Level) *CallerCore
- func (c *CallerCore) UnderlyingLevel() AtomicLevel
- func (c *CallerCore) UseExternalLevel(l AtomicLevel) *CallerCore
- type Config
- type Event
- func OnDPanic() *Event
- func OnDPanicContext(ctx context.Context) *Event
- func OnDebug() *Event
- func OnDebugContext(ctx context.Context) *Event
- func OnError() *Event
- func OnErrorContext(ctx context.Context) *Event
- func OnFatal() *Event
- func OnFatalContext(ctx context.Context) *Event
- func OnInfo() *Event
- func OnInfoContext(ctx context.Context) *Event
- func OnLevel(level Level) *Event
- func OnLevelContext(ctx context.Context, level Level) *Event
- func OnPanic() *Event
- func OnPanicContext(ctx context.Context) *Event
- func OnWarn() *Event
- func OnWarnContext(ctx context.Context) *Event
- func (e *Event) Any(key string, v any) *Event
- func (e *Event) Array(key string, v ArrayMarshaler) *Event
- func (e *Event) Binary(key string, v []byte) *Event
- func (e *Event) Bool(key string, v bool) *Event
- func (e *Event) Boolp(key string, v *bool) *Event
- func (e *Event) ByteString(key string, v []byte) *Event
- func (e *Event) Caller(depth int) *Event
- func (e *Event) CallerFile(depth int) *Event
- func (e *Event) Complex128(key string, v complex128) *Event
- func (e *Event) Complex128p(key string, v *complex128) *Event
- func (e *Event) Complex64(key string, v complex64) *Event
- func (e *Event) Complex64p(key string, v *complex64) *Event
- func (e *Event) Configure(f func(e *Event)) *Event
- func (e *Event) Dict(key string, val ...Field) *Event
- func (e *Event) DoHook(hs ...Hook) *Event
- func (e *Event) DoHookFunc(hs ...HookFunc) *Event
- func (e *Event) Duration(key string, v time.Duration) *Event
- func (e *Event) Durationp(key string, v *time.Duration) *Event
- func (e *Event) Error(val error) *Event
- func (e *Event) Errors(key string, val []error) *Event
- func (e *Event) Float32(key string, v float32) *Event
- func (e *Event) Float32p(key string, v *float32) *Event
- func (e *Event) Float64(key string, v float64) *Event
- func (e *Event) Float64p(key string, v *float64) *Event
- func (e *Event) Inline(val ObjectMarshaler) *Event
- func (e *Event) Int(key string, v int) *Event
- func (e *Event) Int16(key string, v int16) *Event
- func (e *Event) Int16p(key string, v *int16) *Event
- func (e *Event) Int32(key string, v int32) *Event
- func (e *Event) Int32p(key string, v *int32) *Event
- func (e *Event) Int64(key string, v int64) *Event
- func (e *Event) Int64p(key string, v *int64) *Event
- func (e *Event) Int8(key string, v int8) *Event
- func (e *Event) Int8p(key string, v *int8) *Event
- func (e *Event) Intp(key string, v *int) *Event
- func (e *Event) Msg(msg string)
- func (e *Event) NamedError(key string, val error) *Event
- func (e *Event) Namespace(key string) *Event
- func (e *Event) Object(key string, val ObjectMarshaler) *Event
- func (e *Event) Print(args ...any)
- func (e *Event) Printf(template string, args ...any)
- func (e *Event) Reflect(key string, v any) *Event
- func (e *Event) Stack(key string) *Event
- func (e *Event) StackSkip(key string, skip int) *Event
- func (e *Event) String(key string, v string) *Event
- func (e *Event) Stringer(key string, v fmt.Stringer) *Event
- func (e *Event) Stringp(key string, v *string) *Event
- func (e *Event) Time(key string, v time.Time) *Event
- func (e *Event) Timep(key string, v *time.Time) *Event
- func (e *Event) Uint(key string, v uint) *Event
- func (e *Event) Uint16(key string, v uint16) *Event
- func (e *Event) Uint16p(key string, v *uint16) *Event
- func (e *Event) Uint32(key string, v uint32) *Event
- func (e *Event) Uint32p(key string, v *uint32) *Event
- func (e *Event) Uint64(key string, v uint64) *Event
- func (e *Event) Uint64p(key string, v *uint64) *Event
- func (e *Event) Uint8(key string, v uint8) *Event
- func (e *Event) Uint8p(key string, v *uint8) *Event
- func (e *Event) Uintp(key string, v *uint) *Event
- func (e *Event) Uintptr(key string, v uintptr) *Event
- func (e *Event) Uintptrp(key string, v *uintptr) *Event
- func (e *Event) With(fields ...Field) *Event
- func (e *Event) WithContext(ctx context.Context) *Event
- type Field
- func Any(key string, val any) 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 ByteString(key string, val []byte) Field
- func Complex128(key string, val complex128) Field
- func Complex128p(key string, val *complex128) Field
- func Complex64(key string, val complex64) Field
- func Complex64p(key string, val *complex64) Field
- func DefaultCaller(depth int, skipPackages ...string) Field
- func DefaultCallerFile(depth int, skipPackages ...string) Field
- func Dict(key string, val ...Field) Field
- func Duration(key string, val time.Duration) Field
- func Durationp(key string, val *time.Duration) Field
- func Err(val error) Field
- func Errors(key string, val []error) Field
- func Float32(key string, val float32) Field
- func Float32p(key string, val *float32) Field
- func Float64(key string, val float64) Field
- func Float64p(key string, val *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 Int32(key string, val int32) Field
- func Int32p(key string, val *int32) Field
- func Int64(key string, val int64) Field
- func Int64p(key string, val *int64) Field
- func Int8(key string, val int8) Field
- func Int8p(key string, val *int8) Field
- func Intp(key string, val *int) Field
- func NamedError(key string, val error) Field
- func Namespace(key string) Field
- func Object(key string, val ObjectMarshaler) Field
- func Reflect(key string, val any) 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 Time(key string, val time.Time) Field
- func Timep(key string, val *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 Uint32(key string, val uint32) Field
- func Uint32p(key string, val *uint32) Field
- func Uint64(key string, val uint64) Field
- func Uint64p(key string, val *uint64) Field
- func Uint8(key string, val uint8) Field
- func Uint8p(key string, val *uint8) Field
- func Uintp(key string, val *uint) Field
- func Uintptr(key string, val uintptr) Field
- func Uintptrp(key string, val *uintptr) Field
- type Hook
- type HookFunc
- func Caller(depth int, skipPackages ...string) HookFunc
- func File(depth int, skipPackages ...string) HookFunc
- func ImmutAny(key string, v any) HookFunc
- func ImmutBinary(key string, v []byte) HookFunc
- func ImmutBool(key string, v bool) HookFunc
- func ImmutBoolp(key string, v *bool) HookFunc
- func ImmutByteString(key string, v []byte) HookFunc
- func ImmutComplex128(key string, v complex128) HookFunc
- func ImmutComplex128p(key string, v *complex128) HookFunc
- func ImmutComplex64(key string, v complex64) HookFunc
- func ImmutComplex64p(key string, v *complex64) HookFunc
- func ImmutDict(key string, val ...Field) HookFunc
- func ImmutDuration(key string, v time.Duration) HookFunc
- func ImmutDurationp(key string, v *time.Duration) HookFunc
- func ImmutErr(val error) HookFunc
- func ImmutErrors(key string, val []error) HookFunc
- func ImmutFloat32(key string, v float32) HookFunc
- func ImmutFloat32p(key string, v *float32) HookFunc
- func ImmutFloat64(key string, v float64) HookFunc
- func ImmutFloat64p(key string, v *float64) HookFunc
- func ImmutInline(val ObjectMarshaler) HookFunc
- func ImmutInt(key string, v int) HookFunc
- func ImmutInt16(key string, v int16) HookFunc
- func ImmutInt16p(key string, v *int16) HookFunc
- func ImmutInt32(key string, v int32) HookFunc
- func ImmutInt32p(key string, v *int32) HookFunc
- func ImmutInt64(key string, v int64) HookFunc
- func ImmutInt64p(key string, v *int64) HookFunc
- func ImmutInt8(key string, v int8) HookFunc
- func ImmutInt8p(key string, v *int8) HookFunc
- func ImmutIntp(key string, v *int) HookFunc
- func ImmutNamedError(key string, val error) HookFunc
- func ImmutNamespace(key string) HookFunc
- func ImmutObject(key string, val ObjectMarshaler) HookFunc
- func ImmutReflect(key string, v any) HookFunc
- func ImmutStack(key string) HookFunc
- func ImmutStackSkip(key string, skip int) HookFunc
- func ImmutString(key string, v string) HookFunc
- func ImmutStringer(key string, v fmt.Stringer) HookFunc
- func ImmutStringp(key string, v *string) HookFunc
- func ImmutTime(key string, v time.Time) HookFunc
- func ImmutTimep(key string, v *time.Time) HookFunc
- func ImmutUint(key string, v uint) HookFunc
- func ImmutUint16(key string, v uint16) HookFunc
- func ImmutUint16p(key string, v *uint16) HookFunc
- func ImmutUint32(key string, v uint32) HookFunc
- func ImmutUint32p(key string, v *uint32) HookFunc
- func ImmutUint64(key string, v uint64) HookFunc
- func ImmutUint64p(key string, v *uint64) HookFunc
- func ImmutUint8(key string, v uint8) HookFunc
- func ImmutUint8p(key string, v *uint8) HookFunc
- func ImmutUintp(key string, v *uint) HookFunc
- func ImmutUintptr(key string, v uintptr) HookFunc
- func ImmutUintptrp(key string, v *uintptr) HookFunc
- type ImmutableAny
- type ImmutableBinary
- type ImmutableBool
- type ImmutableBoolp
- type ImmutableByteString
- type ImmutableComplex128
- type ImmutableComplex128p
- type ImmutableComplex64
- type ImmutableComplex64p
- type ImmutableDict
- type ImmutableDuration
- type ImmutableDurationp
- type ImmutableErr
- type ImmutableErrors
- type ImmutableField
- type ImmutableFloat32
- type ImmutableFloat32p
- type ImmutableFloat64
- type ImmutableFloat64p
- type ImmutableInline
- type ImmutableInt
- type ImmutableInt16
- type ImmutableInt16p
- type ImmutableInt32
- type ImmutableInt32p
- type ImmutableInt64
- type ImmutableInt64p
- type ImmutableInt8
- type ImmutableInt8p
- type ImmutableIntp
- type ImmutableNamedError
- type ImmutableNamedField
- type ImmutableNamespace
- type ImmutableObject
- type ImmutableReflect
- type ImmutableStack
- type ImmutableStackSkip
- type ImmutableString
- type ImmutableStringer
- type ImmutableStringp
- type ImmutableTime
- type ImmutableTimep
- type ImmutableUint
- type ImmutableUint16
- type ImmutableUint16p
- type ImmutableUint32
- type ImmutableUint32p
- type ImmutableUint64
- type ImmutableUint64p
- type ImmutableUint8
- type ImmutableUint8p
- type ImmutableUintp
- type ImmutableUintptr
- type ImmutableUintptrp
- type Level
- type Log
- func AddCallerSkip(callerSkip int) *Log
- func AddCallerSkipPackage(vs ...string) *Log
- func ExtendDefaultHook(hs ...Hook) *Log
- func ExtendDefaultHookFunc(hs ...HookFunc) *Log
- func ExtendHook(hs ...Hook) *Log
- func ExtendHookFunc(hs ...HookFunc) *Log
- func Named(name string) *Log
- func NewLogger(opts ...Option) *Log
- func NewLoggerWith(logger *zap.Logger, lv AtomicLevel) *Log
- func SetCallerLevel(lv Level) *Log
- func SetLevel(lv Level) *Log
- func SetNewCallerCore(c *CallerCore) *Log
- func UnderlyingLogger() *Log
- func UseExternalCallerLevel(lvl AtomicLevel) *Log
- func With(fields ...Field) *Log
- func WithNewHook(hs ...Hook) *Log
- func WithNewHookFunc(hs ...HookFunc) *Log
- func (l *Log) AddCallerSkip(callerSkip int) *Log
- func (l *Log) AddCallerSkipPackage(vs ...string) *Log
- func (l *Log) DPanic(args ...any)
- func (l *Log) DPanicf(template string, args ...any)
- func (l *Log) Debug(args ...any)
- func (l *Log) Debugf(template string, args ...any)
- func (l *Log) Enabled(lvl Level) bool
- func (l *Log) Error(args ...any)
- func (l *Log) Errorf(template string, args ...any)
- func (l *Log) ExtendDefaultHook(hs ...Hook) *Log
- func (l *Log) ExtendDefaultHookFunc(hs ...HookFunc) *Log
- func (l *Log) ExtendHook(hs ...Hook) *Log
- func (l *Log) ExtendHookFunc(hs ...HookFunc) *Log
- func (l *Log) Fatal(args ...any)
- func (l *Log) Fatalf(template string, args ...any)
- func (l *Log) GetLevel() Level
- func (l *Log) Info(args ...any)
- func (l *Log) Infof(template string, args ...any)
- func (l *Log) Logger() *zap.Logger
- func (l *Log) Named(name string) *Log
- func (l *Log) OnDPanic() *Event
- func (l *Log) OnDPanicContext(ctx context.Context) *Event
- func (l *Log) OnDebug() *Event
- func (l *Log) OnDebugContext(ctx context.Context) *Event
- func (l *Log) OnError() *Event
- func (l *Log) OnErrorContext(ctx context.Context) *Event
- func (l *Log) OnFatal() *Event
- func (l *Log) OnFatalContext(ctx context.Context) *Event
- func (l *Log) OnInfo() *Event
- func (l *Log) OnInfoContext(ctx context.Context) *Event
- func (l *Log) OnLevel(level Level) *Event
- func (l *Log) OnLevelContext(ctx context.Context, level Level) *Event
- func (l *Log) OnPanic() *Event
- func (l *Log) OnPanicContext(ctx context.Context) *Event
- func (l *Log) OnWarn() *Event
- func (l *Log) OnWarnContext(ctx context.Context) *Event
- func (l *Log) Panic(args ...any)
- func (l *Log) Panicf(template string, args ...any)
- func (l *Log) SetCaller(f func(depth int, skipPackages ...string) Field) *Log
- func (l *Log) SetCallerLevel(lv Level) *Log
- func (l *Log) SetLevel(lv Level) *Log
- func (l *Log) SetLevelWithText(text string) error
- func (l *Log) SetNewCallerCore(c *CallerCore) *Log
- func (l *Log) Sugar() *zap.SugaredLogger
- func (l *Log) Sync() error
- func (l *Log) UnderlyingCallerLevel() AtomicLevel
- func (l *Log) UseExternalCallerLevel(lvl AtomicLevel) *Log
- func (l *Log) V(lvl Level) bool
- func (l *Log) Warn(args ...any)
- func (l *Log) Warnf(template string, args ...any)
- func (l *Log) With(fields ...Field) *Log
- func (l *Log) WithNewHook(hs ...Hook) *Log
- func (l *Log) WithNewHookFunc(hs ...HookFunc) *Log
- type LumberjackFile
- type MutableAny
- type MutableBinary
- type MutableBool
- type MutableBoolp
- type MutableByteString
- type MutableComplex128
- type MutableComplex128p
- type MutableComplex64
- type MutableComplex64p
- type MutableDict
- type MutableDuration
- type MutableDurationp
- type MutableErr
- type MutableErrors
- type MutableFixedNamedField
- type MutableFloat32
- type MutableFloat32p
- type MutableFloat64
- type MutableFloat64p
- type MutableInline
- type MutableInt
- type MutableInt16
- type MutableInt16p
- type MutableInt32
- type MutableInt32p
- type MutableInt64
- type MutableInt64p
- type MutableInt8
- type MutableInt8p
- type MutableIntp
- type MutableNamedError
- type MutableNamedField
- type MutableNamespace
- type MutableObject
- type MutableReflect
- type MutableString
- type MutableStringer
- type MutableStringp
- type MutableTime
- type MutableTimep
- type MutableUint
- type MutableUint16
- type MutableUint16p
- type MutableUint32
- type MutableUint32p
- type MutableUint64
- type MutableUint64p
- type MutableUint8
- type MutableUint8p
- type MutableUintp
- type MutableUintptr
- type MutableUintptrp
- type ObjectEncoder
- type ObjectMarshaler
- type Option
- func WithAdapter(adapter string, writer ...io.Writer) Option
- func WithConfig(cfg Config) Option
- func WithEnableCompress() Option
- func WithEnableLocalTime() Option
- func WithEncodeLevel(encodeLevel string) Option
- func WithEncoderConfig(encoderConfig *zapcore.EncoderConfig) Option
- func WithFilename(filename string) Option
- func WithFormat(format string) Option
- func WithLevel(level string) Option
- func WithMaxAge(maxAge int) Option
- func WithMaxBackups(maxBackups int) Option
- func WithMaxSize(maxSize int) Option
- func WithPath(path string) Option
- func WithStack(stack bool) Option
Constants ¶
const ( DebugLevel = zap.DebugLevel InfoLevel = zap.InfoLevel WarnLevel = zap.WarnLevel ErrorLevel = zap.ErrorLevel DPanicLevel = zap.DPanicLevel PanicLevel = zap.PanicLevel FatalLevel = zap.FatalLevel )
log level defined
const ( AdapterConsole = "console" // console AdapterFile = "file" // file AdapterMulti = "multi" // file and console AdapterCustom = "custom" // custom io.Writer AdapterConsoleCustom = "console-custom" // console and custom io.Writer AdapterFileCustom = "file-custom" // file and custom io.Writer AdapterMultiCustom = "multi-custom" // file, console and custom io.Writer )
adapter defined
const ( FormatJson = "json" FormatConsole = "console" )
format defined
const ( EncodeLevelLowercase = "LowercaseLevelEncoder" // 小写编码器 EncodeLevelLowercaseColor = "LowercaseColorLevelEncoder" // 小写编码器带颜色 EncodeLevelCapital = "CapitalLevelEncoder" // 大写编码器 EncodeLevelCapitalColor = "CapitalColorLevelEncoder" // 大写编码器带颜色 )
encode level defined
Variables ¶
This section is empty.
Functions ¶
func ReplaceGlobals ¶
func ReplaceGlobals(logger *Log)
ReplaceGlobals replaces the global Log only once.
func SetLevelWithText ¶
SetLevelWithText alters the logging level. ParseAtomicLevel set the logging level based on a lowercase or all-caps ASCII representation of the log level. If the provided ASCII representation is invalid an error is returned.
func Sugar ¶
func Sugar() *zap.SugaredLogger
Sugar wraps the Logger to provide a more ergonomic, but slightly slower, API. Sugaring a Logger is quite inexpensive, so it's reasonable for a single application to use both Loggers and SugaredLoggers, converting between them on the boundaries of performance-sensitive code.
Types ¶
type ArrayEncoder ¶ added in v1.0.0
type ArrayEncoder = zapcore.ArrayEncoder
type ArrayMarshaler ¶ added in v1.0.0
type ArrayMarshaler = zapcore.ArrayMarshaler
type AtomicLevel ¶
type AtomicLevel = zap.AtomicLevel
func NewAtomicLevel ¶
func NewAtomicLevel() AtomicLevel
NewAtomicLevel creates an AtomicLevel with InfoLevel and above logging enabled.
func NewAtomicLevelAt ¶
func NewAtomicLevelAt(l Level) AtomicLevel
NewAtomicLevelAt is a convenience function that creates an AtomicLevel and then calls SetLevel with the given level.
func ParseAtomicLevel ¶
func ParseAtomicLevel(text string) (AtomicLevel, error)
ParseAtomicLevel parses an AtomicLevel based on a lowercase or all-caps ASCII representation of the log level. If the provided ASCII representation is invalid an error is returned.
func UnderlyingCallerLevel ¶
func UnderlyingCallerLevel() AtomicLevel
UnderlyingCallerLevel get underlying caller level.
type CallerCore ¶
type CallerCore struct {
Skip int
SkipPackages []string
Caller func(depth int, skipPackages ...string) Field
// contains filtered or unexported fields
}
func NewCallerCore ¶
func NewCallerCore() *CallerCore
func (*CallerCore) AddSkip ¶
func (c *CallerCore) AddSkip(callerSkip int) *CallerCore
AddSkip add the number of callers skipped by caller annotation.
func (*CallerCore) AddSkipPackage ¶
func (c *CallerCore) AddSkipPackage(vs ...string) *CallerCore
AddSkipPackage add the caller skip package.
func (*CallerCore) Enabled ¶
func (c *CallerCore) Enabled(lvl Level) bool
Enabled returns true if the given level is at or above this level.
func (*CallerCore) Level ¶
func (c *CallerCore) Level() Level
Level returns the minimum enabled log level.
func (*CallerCore) SetLevel ¶
func (c *CallerCore) SetLevel(lv Level) *CallerCore
SetLevel set the caller level.
func (*CallerCore) UnderlyingLevel ¶
func (c *CallerCore) UnderlyingLevel() AtomicLevel
UnderlyingLevel get underlying level.
func (*CallerCore) UseExternalLevel ¶
func (c *CallerCore) UseExternalLevel(l AtomicLevel) *CallerCore
UseExternalLevel use external level, which controller by user.
type Config ¶
type Config struct {
// Level 日志等级, debug,info,warn,error,dpanic,panic,fatal, 默认warn
Level string `yaml:"level" json:"level"`
// Format: 编码格式: json,console 默认json
Format string `yaml:"format" json:"format"`
// 编码器类型, 默认: LowercaseLevelEncoder
// LowercaseLevelEncoder: 小写编码器
// LowercaseColorLevelEncoder: 小写编码器带颜色
// CapitalLevelEncoder: 大写编码器
// CapitalColorLevelEncoder: 大写编码器带颜色
EncodeLevel string `yaml:"encodeLevel" json:"encodeLevel"`
// Adapter 输出适配器, file,console,multi,custom,file-custom,console-custom,multi-custom 默认 console
Adapter string `yaml:"adapter" json:"adapter"`
// Stack 是否使能栈调试输出, 默认false
Stack bool `yaml:"stack" json:"stack"`
// Writer 输出
// 当adapter有附带custom时, 如果为writer为空, 将使用os.Stdout
Writer []io.Writer `yaml:"-" json:"-"`
// EncoderConfig 如果配置该项,则 EncodeLevel 将被覆盖
EncoderConfig *zapcore.EncoderConfig `yaml:"-" json:"-"`
// 文件配置, 仅Adapter有file时有效
File LumberjackFile `yaml:"file" json:"file"`
}
Config 日志配置
type Event ¶ added in v1.0.0
type Event struct {
// contains filtered or unexported fields
}
Event represents a log event. It is instanced by one of the level method of Logger and finalized by the Msg, Print, Printf method.
func OnDPanic ¶ added in v1.0.0
func OnDPanic() *Event
OnDPanic starts a new message with DPanicLevel level.
You must call Msg on the returned event in order to send the event.
func OnDPanicContext ¶ added in v1.0.0
OnDPanicContext starts a new message with DPanicLevel level, and adds the Go Context to the *Event context.
You must call Msg on the returned event in order to send the event.
func OnDebug ¶ added in v1.0.0
func OnDebug() *Event
OnDebug starts a new message with DebugLevel level.
You must call Msg on the returned event in order to send the event.
func OnDebugContext ¶ added in v1.0.0
Debug starts a new message with DebugLevel level, and adds the Go Context to the *Event context.
You must call Msg on the returned event in order to send the event.
func OnError ¶ added in v1.0.0
func OnError() *Event
OnError starts a new message with ErrorLevel level.
You must call Msg on the returned event in order to send the event.
func OnErrorContext ¶ added in v1.0.0
OnErrorContext starts a new message with ErrorLevel level, and adds the Go Context to the *Event context.
You must call Msg on the returned event in order to send the event.
func OnFatal ¶ added in v1.0.0
func OnFatal() *Event
OnFatal starts a new message with FatalLevel level.
You must call Msg on the returned event in order to send the event.
func OnFatalContext ¶ added in v1.0.0
OnFatalContext starts a new message with FatalLevel level, and adds the Go Context to the *Event context.
You must call Msg on the returned event in order to send the event.
func OnInfo ¶ added in v1.0.0
func OnInfo() *Event
OnInfo starts a new message with InfoLevel level.
You must call Msg on the returned event in order to send the event.
func OnInfoContext ¶ added in v1.0.0
OnInfoContext starts a new message with InfoLevel level, and adds the Go Context to the *Event context.
You must call Msg on the returned event in order to send the event.
func OnLevel ¶ added in v1.0.0
OnLevel starts a new message with customize level.
You must call Msg on the returned event in order to send the event.
func OnLevelContext ¶ added in v1.0.0
OnLevelContext starts a new message with customize level, and adds the Go Context to the *Event context.
You must call Msg on the returned event in order to send the event.
func OnPanic ¶ added in v1.0.0
func OnPanic() *Event
OnPanic starts a new message with PanicLevel level.
You must call Msg on the returned event in order to send the event.
func OnPanicContext ¶ added in v1.0.0
OnPanicContext starts a new message with PanicLevel level, and adds the Go Context to the *Event context.
You must call Msg on the returned event in order to send the event.
func OnWarn ¶ added in v1.0.0
func OnWarn() *Event
OnWarn starts a new message with WarnLevel level.
You must call Msg on the returned event in order to send the event.
func OnWarnContext ¶ added in v1.0.0
OnWarnContext starts a new message with WarnLevel level, and adds the Go Context to the *Event context.
You must call Msg on the returned event in order to send the event.
func (*Event) CallerFile ¶ added in v1.0.0
func (*Event) Complex128 ¶ added in v1.0.0
func (e *Event) Complex128(key string, v complex128) *Event
func (*Event) Complex128p ¶ added in v1.0.0
func (e *Event) Complex128p(key string, v *complex128) *Event
func (*Event) Complex64p ¶ added in v1.0.0
func (*Event) DoHookFunc ¶ added in v1.0.0
DoHookFunc do hook func immediately.
func (*Event) Inline ¶ added in v1.0.0
func (e *Event) Inline(val ObjectMarshaler) *Event
func (*Event) Msg ¶ added in v1.0.0
NOTICE: once this method is called, the *Event should be disposed.
func (*Event) Object ¶ added in v1.0.0
func (e *Event) Object(key string, val ObjectMarshaler) *Event
func (*Event) Print ¶ added in v1.0.0
NOTICE: once this method is called, the *Event should be disposed.
func (*Event) Printf ¶ added in v1.0.0
NOTICE: once this method is called, the *Event should be disposed.
func (*Event) WithContext ¶ added in v1.0.0
WithContext adds the Go Context to the *Event context. The context is not rendered in the output message, but is available to hooks calls. A typical use case is to extract tracing information from the Go Ctx.
type Field ¶
func Array ¶ added in v1.0.0
func Array(key string, val ArrayMarshaler) Field
func ByteString ¶
func Complex128 ¶
func Complex128(key string, val complex128) Field
func Complex128p ¶
func Complex128p(key string, val *complex128) Field
func Complex64p ¶
func DefaultCaller ¶
DefaultCaller caller.
func DefaultCallerFile ¶
DefaultCallerFile caller file.
func Inline ¶
func Inline(val ObjectMarshaler) Field
func NamedError ¶
func Object ¶
func Object(key string, val ObjectMarshaler) Field
type HookFunc ¶ added in v1.0.0
HookFunc is an adaptor to allow the use of an ordinary function as a Hook.
func ImmutBinary ¶
func ImmutBoolp ¶
func ImmutByteString ¶
func ImmutComplex128 ¶
func ImmutComplex128(key string, v complex128) HookFunc
func ImmutComplex128p ¶
func ImmutComplex128p(key string, v *complex128) HookFunc
func ImmutComplex64 ¶
func ImmutComplex64p ¶
func ImmutErrors ¶
func ImmutFloat32 ¶
func ImmutFloat32p ¶
func ImmutFloat64 ¶
func ImmutFloat64p ¶
func ImmutInline ¶
func ImmutInline(val ObjectMarshaler) HookFunc
func ImmutInt16 ¶
func ImmutInt16p ¶
func ImmutInt32 ¶
func ImmutInt32p ¶
func ImmutInt64 ¶
func ImmutInt64p ¶
func ImmutInt8p ¶
func ImmutNamedError ¶
func ImmutNamespace ¶
func ImmutObject ¶
func ImmutObject(key string, val ObjectMarshaler) HookFunc
func ImmutReflect ¶
func ImmutStack ¶
func ImmutStackSkip ¶
func ImmutString ¶
func ImmutStringp ¶
func ImmutUint16 ¶
func ImmutUint16p ¶
func ImmutUint32 ¶
func ImmutUint32p ¶
func ImmutUint64 ¶
func ImmutUint64p ¶
func ImmutUint8 ¶
func ImmutUint8p ¶
func ImmutUintp ¶
func ImmutUintptr ¶
func ImmutUintptrp ¶
type ImmutableAny ¶ added in v1.0.0
type ImmutableAny ImmutableNamedField[any]
type ImmutableBinary ¶ added in v1.0.0
type ImmutableBinary ImmutableNamedField[[]byte]
type ImmutableBool ¶ added in v1.0.0
type ImmutableBool ImmutableNamedField[bool]
type ImmutableBoolp ¶ added in v1.0.0
type ImmutableBoolp ImmutableNamedField[*bool]
type ImmutableByteString ¶ added in v1.0.0
type ImmutableByteString ImmutableNamedField[[]byte]
type ImmutableComplex128 ¶ added in v1.0.0
type ImmutableComplex128 ImmutableNamedField[complex128]
type ImmutableComplex128p ¶ added in v1.0.0
type ImmutableComplex128p ImmutableNamedField[*complex128]
type ImmutableComplex64 ¶ added in v1.0.0
type ImmutableComplex64 ImmutableNamedField[complex64]
type ImmutableComplex64p ¶ added in v1.0.0
type ImmutableComplex64p ImmutableNamedField[*complex64]
type ImmutableDict ¶ added in v1.0.0
type ImmutableDict ImmutableNamedField[[]Field]
type ImmutableDuration ¶ added in v1.0.0
type ImmutableDuration ImmutableNamedField[time.Duration]
type ImmutableDurationp ¶ added in v1.0.0
type ImmutableDurationp ImmutableNamedField[*time.Duration]
type ImmutableErr ¶ added in v1.0.0
type ImmutableErr ImmutableField[error]
type ImmutableErrors ¶ added in v1.0.0
type ImmutableErrors ImmutableNamedField[[]error]
type ImmutableField ¶ added in v1.0.0
type ImmutableField[T any] struct { Value T }
type ImmutableFloat32 ¶ added in v1.0.0
type ImmutableFloat32 ImmutableNamedField[float32]
type ImmutableFloat32p ¶ added in v1.0.0
type ImmutableFloat32p ImmutableNamedField[*float32]
type ImmutableFloat64 ¶ added in v1.0.0
type ImmutableFloat64 ImmutableNamedField[float64]
type ImmutableFloat64p ¶ added in v1.0.0
type ImmutableFloat64p ImmutableNamedField[*float64]
type ImmutableInline ¶ added in v1.0.0
type ImmutableInline ImmutableField[ObjectMarshaler]
type ImmutableInt ¶ added in v1.0.0
type ImmutableInt ImmutableNamedField[int]
type ImmutableInt16 ¶ added in v1.0.0
type ImmutableInt16 ImmutableNamedField[int16]
type ImmutableInt16p ¶ added in v1.0.0
type ImmutableInt16p ImmutableNamedField[*int16]
type ImmutableInt32 ¶ added in v1.0.0
type ImmutableInt32 ImmutableNamedField[int32]
type ImmutableInt32p ¶ added in v1.0.0
type ImmutableInt32p ImmutableNamedField[*int32]
type ImmutableInt64 ¶ added in v1.0.0
type ImmutableInt64 ImmutableNamedField[int64]
type ImmutableInt64p ¶ added in v1.0.0
type ImmutableInt64p ImmutableNamedField[*int64]
type ImmutableInt8 ¶ added in v1.0.0
type ImmutableInt8 ImmutableNamedField[int8]
type ImmutableInt8p ¶ added in v1.0.0
type ImmutableInt8p ImmutableNamedField[*int8]
type ImmutableIntp ¶ added in v1.0.0
type ImmutableIntp ImmutableNamedField[*int]
type ImmutableNamedError ¶ added in v1.0.0
type ImmutableNamedError ImmutableNamedField[error]
type ImmutableNamedField ¶ added in v1.0.0
type ImmutableNamespace ¶ added in v1.0.0
type ImmutableNamespace ImmutableField[string]
type ImmutableObject ¶ added in v1.0.0
type ImmutableObject ImmutableNamedField[ObjectMarshaler]
type ImmutableReflect ¶ added in v1.0.0
type ImmutableReflect ImmutableNamedField[any]
type ImmutableStack ¶ added in v1.0.0
type ImmutableStack struct {
Key string
}
type ImmutableStackSkip ¶ added in v1.0.0
type ImmutableString ¶ added in v1.0.0
type ImmutableString ImmutableNamedField[string]
type ImmutableStringer ¶ added in v1.0.0
type ImmutableStringer ImmutableNamedField[fmt.Stringer]
type ImmutableStringp ¶ added in v1.0.0
type ImmutableStringp ImmutableNamedField[*string]
type ImmutableTime ¶ added in v1.0.0
type ImmutableTime ImmutableNamedField[time.Time]
type ImmutableTimep ¶ added in v1.0.0
type ImmutableTimep ImmutableNamedField[*time.Time]
type ImmutableUint ¶ added in v1.0.0
type ImmutableUint ImmutableNamedField[uint]
type ImmutableUint16 ¶ added in v1.0.0
type ImmutableUint16 ImmutableNamedField[uint16]
type ImmutableUint16p ¶ added in v1.0.0
type ImmutableUint16p ImmutableNamedField[*uint16]
type ImmutableUint32 ¶ added in v1.0.0
type ImmutableUint32 ImmutableNamedField[uint32]
type ImmutableUint32p ¶ added in v1.0.0
type ImmutableUint32p ImmutableNamedField[*uint32]
type ImmutableUint64 ¶ added in v1.0.0
type ImmutableUint64 ImmutableNamedField[uint64]
type ImmutableUint64p ¶ added in v1.0.0
type ImmutableUint64p ImmutableNamedField[*uint64]
type ImmutableUint8 ¶ added in v1.0.0
type ImmutableUint8 ImmutableNamedField[uint8]
type ImmutableUint8p ¶ added in v1.0.0
type ImmutableUint8p ImmutableNamedField[*uint8]
type ImmutableUintp ¶ added in v1.0.0
type ImmutableUintp ImmutableNamedField[*uint]
type ImmutableUintptr ¶ added in v1.0.0
type ImmutableUintptr ImmutableNamedField[uintptr]
type ImmutableUintptrp ¶ added in v1.0.0
type ImmutableUintptrp ImmutableNamedField[*uintptr]
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log wrap zap logger
func AddCallerSkip ¶
AddCallerSkip add the number of callers skipped by caller annotation.
func AddCallerSkipPackage ¶
AddCallerSkipPackage add the caller skip package.
func ExtendDefaultHook ¶ added in v1.0.1
ExtendDefaultHook set default hook, which hold always until you call Event.Msg/Event.Print/Event.Printf.
func ExtendDefaultHookFunc ¶ added in v1.0.1
ExtendDefaultHookFunc set default hook, which hold always until you call Event.Msg/Event.Print/Event.Printf.
func ExtendHook ¶ added in v1.0.0
ExtendHook creates a child log with extend Hook.
func ExtendHookFunc ¶ added in v1.0.0
ExtendHookFunc creates a child log with extend Hook.
func NewLogger ¶
NewLogger new logger 默认配置:
Level: 日志等级, 默认warn Format: 编码格式, 默认json EncodeLevel: 编码器类型, 默认LowercaseLevelEncoder Adapter: 默认输出适合器, 默认console` Stack: 是否使能栈调试输出, 默认false Path: 日志保存路径, 默认当前路径 Writer: 当adapter有附带custom时, 如果为writer为空, 将使用os.Stdout EncoderConfig: 如果配置该项,则 EncodeLevel 将被覆盖
文件日志切割配置(启用file时生效) Filename 空字符使用默认, 默认<processname>-lumberjack.log MaxSize 每个日志文件最大尺寸(MB), 默认100MB MaxAge 日志文件保存天数, 默认0 不删除 MaxBackups 日志文件保存备份数, 默认0 都保存 LocalTime 是否格式化时间戳, 默认UTC时间 Compress 是否使用gzip压缩文件, 采用默认不压缩
Caller相关 callerLevel caller日志级别, 默认warn callerSkip caller设置跳过深度, 默认0 callerSkipPackages caller设置跳过的包名, 默认空
func NewLoggerWith ¶
func NewLoggerWith(logger *zap.Logger, lv AtomicLevel) *Log
NewLoggerWith new logger with zap logger and atomic level
func SetNewCallerCore ¶ added in v1.0.1
func SetNewCallerCore(c *CallerCore) *Log
SetNewCallerCore overwrite with new caller core
func UseExternalCallerLevel ¶
func UseExternalCallerLevel(lvl AtomicLevel) *Log
UseExternalCallerLevel use external caller level, which controller by user.
func With ¶
With creates a child log and adds structured context to it. Fields added to the child don't affect the parent, and vice versa.
NOTICE: if you do not need a child log, use Event.With instead.
func WithNewHook ¶ added in v1.0.0
WithNewHook creates a child log with new hook without default hook.
func WithNewHookFunc ¶ added in v1.0.0
WithNewHookFunc creates a child log with new hook func without default hook.
func (*Log) AddCallerSkip ¶
AddCallerSkip add the number of callers skipped by caller annotation.
func (*Log) AddCallerSkipPackage ¶
AddCallerSkipPackage add the caller skip package.
func (*Log) ExtendDefaultHook ¶ added in v1.0.0
ExtendDefaultHook set default hook, which hold always until you call Event.Msg/Event.Print/Event.Printf.
func (*Log) ExtendDefaultHookFunc ¶ added in v1.0.0
ExtendDefaultHookFunc set default hook, which hold always until you call Event.Msg/Event.Print/Event.Printf.
func (*Log) ExtendHook ¶ added in v1.0.0
ExtendHook creates a child log with extend Hook.
func (*Log) ExtendHookFunc ¶ added in v1.0.0
ExtendHookFunc creates a child log with extend Hook.
func (*Log) OnDPanic ¶ added in v1.0.0
OnDPanic starts a new message with DPanicLevel level.
You must call Msg on the returned event in order to send the event.
func (*Log) OnDPanicContext ¶ added in v1.0.0
OnDPanicContext starts a new message with DPanicLevel level, and adds the Go Context to the *Event context.
You must call Msg on the returned event in order to send the event.
func (*Log) OnDebug ¶ added in v1.0.0
OnDebug starts a new message with DebugLevel level.
You must call Msg on the returned event in order to send the event.
func (*Log) OnDebugContext ¶ added in v1.0.0
Debug starts a new message with DebugLevel level, and adds the Go Context to the *Event context.
You must call Msg on the returned event in order to send the event.
func (*Log) OnError ¶ added in v1.0.0
OnError starts a new message with ErrorLevel level.
You must call Msg on the returned event in order to send the event.
func (*Log) OnErrorContext ¶ added in v1.0.0
OnErrorContext starts a new message with ErrorLevel level, and adds the Go Context to the *Event context.
You must call Msg on the returned event in order to send the event.
func (*Log) OnFatal ¶ added in v1.0.0
OnFatal starts a new message with FatalLevel level.
You must call Msg on the returned event in order to send the event.
func (*Log) OnFatalContext ¶ added in v1.0.0
OnFatalContext starts a new message with FatalLevel level, and adds the Go Context to the *Event context.
You must call Msg on the returned event in order to send the event.
func (*Log) OnInfo ¶ added in v1.0.0
OnInfo starts a new message with InfoLevel level.
You must call Msg on the returned event in order to send the event.
func (*Log) OnInfoContext ¶ added in v1.0.0
OnInfoContext starts a new message with InfoLevel level, and adds the Go Context to the *Event context.
You must call Msg on the returned event in order to send the event.
func (*Log) OnLevel ¶ added in v1.0.0
OnLevel starts a new message with customize level.
You must call Msg on the returned event in order to send the event.
func (*Log) OnLevelContext ¶ added in v1.0.0
OnLevelContext starts a new message with customize level, and adds the Go Context to the *Event context.
You must call Msg on the returned event in order to send the event.
func (*Log) OnPanic ¶ added in v1.0.0
OnPanic starts a new message with PanicLevel level.
You must call Msg on the returned event in order to send the event.
func (*Log) OnPanicContext ¶ added in v1.0.0
OnPanicContext starts a new message with PanicLevel level, and adds the Go Context to the *Event context.
You must call Msg on the returned event in order to send the event.
func (*Log) OnWarn ¶ added in v1.0.0
OnWarn starts a new message with WarnLevel level.
You must call Msg on the returned event in order to send the event.
func (*Log) OnWarnContext ¶ added in v1.0.0
OnWarnContext starts a new message with WarnLevel level, and adds the Go Context to the *Event context.
You must call Msg on the returned event in order to send the event.
func (*Log) SetCallerLevel ¶
SetCallerLevel set the caller level.
func (*Log) SetLevelWithText ¶
SetLevelWithText alters the logging level. ParseAtomicLevel set the logging level based on a lowercase or all-caps ASCII representation of the log level. If the provided ASCII representation is invalid an error is returned. see zapcore.Level
func (*Log) SetNewCallerCore ¶ added in v1.0.0
func (l *Log) SetNewCallerCore(c *CallerCore) *Log
SetNewCallerCore overwrite with new caller core
func (*Log) Sugar ¶
func (l *Log) Sugar() *zap.SugaredLogger
Sugar wraps the Logger to provide a more ergonomic, but slightly slower, API. Sugaring a Logger is quite inexpensive, so it's reasonable for a single application to use both Loggers and SugaredLoggers, converting between them on the boundaries of performance-sensitive code.
func (*Log) UnderlyingCallerLevel ¶
func (l *Log) UnderlyingCallerLevel() AtomicLevel
UnderlyingCallerLevel return underlying caller level.
func (*Log) UseExternalCallerLevel ¶
func (l *Log) UseExternalCallerLevel(lvl AtomicLevel) *Log
UseExternalCallerLevel use external caller level, which controller by user.
func (*Log) With ¶
With creates a child log and adds structured context to it. Fields added to the child don't affect the parent, and vice versa.
NOTICE: if you do not need a child log, use Event.With instead.
func (*Log) WithNewHook ¶ added in v1.0.0
WithNewHook creates a child log with new hook without default hook.
func (*Log) WithNewHookFunc ¶ added in v1.0.0
WithNewHookFunc creates a child log with new hook func without default hook.
type LumberjackFile ¶
type LumberjackFile struct {
// Path 日志保存路径, 默认 empty, 即当前路径
Path string `yaml:"path" json:"path"`
// see https://github.com/natefinch/lumberjack
// lumberjack.Log
// Filename 空字符使用默认, 默认<processname>-lumberjack.log
Filename string `yaml:"filename" json:"filename"`
// MaxSize 每个日志文件最大尺寸(MB), 默认100MB
MaxSize int `yaml:"maxSize" json:"maxSize"`
// MaxAge 日志文件保存天数, 默认0 不删除
MaxAge int `yaml:"maxAge" json:"maxAge"`
// MaxBackups 日志文件保存备份数, 默认0 都保存
MaxBackups int `yaml:"maxBackups" json:"maxBackups"`
// LocalTime 是否格式化时间戳, 默认UTC时间
LocalTime bool `yaml:"localTime" json:"localTime"`
// Compress 是否使用gzip压缩文件, 采用默认不压缩
Compress bool `yaml:"compress" json:"compress"`
}
type MutableAny ¶ added in v1.0.0
type MutableAny MutableNamedField[any]
type MutableBinary ¶ added in v1.0.0
type MutableBinary MutableNamedField[[]byte]
type MutableBool ¶ added in v1.0.0
type MutableBool MutableNamedField[bool]
type MutableBoolp ¶ added in v1.0.0
type MutableBoolp MutableNamedField[*bool]
type MutableByteString ¶ added in v1.0.0
type MutableByteString MutableNamedField[[]byte]
type MutableComplex128 ¶ added in v1.0.0
type MutableComplex128 MutableNamedField[complex128]
type MutableComplex128p ¶ added in v1.0.0
type MutableComplex128p MutableNamedField[*complex128]
type MutableComplex64 ¶ added in v1.0.0
type MutableComplex64 MutableNamedField[complex64]
type MutableComplex64p ¶ added in v1.0.0
type MutableComplex64p MutableNamedField[*complex64]
type MutableDict ¶ added in v1.0.0
type MutableDict MutableNamedField[[]Field]
type MutableDuration ¶ added in v1.0.0
type MutableDuration MutableNamedField[time.Duration]
type MutableDurationp ¶ added in v1.0.0
type MutableDurationp MutableNamedField[*time.Duration]
type MutableErr ¶ added in v1.0.0
type MutableErr MutableFixedNamedField[error]
type MutableErrors ¶ added in v1.0.0
type MutableErrors MutableNamedField[[]error]
type MutableFixedNamedField ¶ added in v1.0.0
type MutableFloat32 ¶ added in v1.0.0
type MutableFloat32 MutableNamedField[float32]
type MutableFloat32p ¶ added in v1.0.0
type MutableFloat32p MutableNamedField[*float32]
type MutableFloat64 ¶ added in v1.0.0
type MutableFloat64 MutableNamedField[float64]
type MutableFloat64p ¶ added in v1.0.0
type MutableFloat64p MutableNamedField[*float64]
type MutableInline ¶ added in v1.0.0
type MutableInline MutableFixedNamedField[ObjectMarshaler]
type MutableInt ¶ added in v1.0.0
type MutableInt MutableNamedField[int]
type MutableInt16 ¶ added in v1.0.0
type MutableInt16 MutableNamedField[int16]
type MutableInt16p ¶ added in v1.0.0
type MutableInt16p MutableNamedField[*int16]
type MutableInt32 ¶ added in v1.0.0
type MutableInt32 MutableNamedField[int32]
type MutableInt32p ¶ added in v1.0.0
type MutableInt32p MutableNamedField[*int32]
type MutableInt64 ¶ added in v1.0.0
type MutableInt64 MutableNamedField[int64]
type MutableInt64p ¶ added in v1.0.0
type MutableInt64p MutableNamedField[*int64]
type MutableInt8 ¶ added in v1.0.0
type MutableInt8 MutableNamedField[int8]
type MutableInt8p ¶ added in v1.0.0
type MutableInt8p MutableNamedField[*int8]
type MutableIntp ¶ added in v1.0.0
type MutableIntp MutableNamedField[*int]
type MutableNamedError ¶ added in v1.0.0
type MutableNamedError MutableNamedField[error]
type MutableNamedField ¶ added in v1.0.0
type MutableNamespace ¶ added in v1.0.0
type MutableNamespace MutableFixedNamedField[string]
type MutableObject ¶ added in v1.0.0
type MutableObject MutableNamedField[ObjectMarshaler]
type MutableReflect ¶ added in v1.0.0
type MutableReflect MutableNamedField[any]
type MutableString ¶ added in v1.0.0
type MutableString MutableNamedField[string]
type MutableStringer ¶ added in v1.0.0
type MutableStringer MutableNamedField[fmt.Stringer]
type MutableStringp ¶ added in v1.0.0
type MutableStringp MutableNamedField[*string]
type MutableTime ¶ added in v1.0.0
type MutableTime MutableNamedField[time.Time]
type MutableTimep ¶ added in v1.0.0
type MutableTimep MutableNamedField[*time.Time]
type MutableUint ¶ added in v1.0.0
type MutableUint MutableNamedField[uint]
type MutableUint16 ¶ added in v1.0.0
type MutableUint16 MutableNamedField[uint16]
type MutableUint16p ¶ added in v1.0.0
type MutableUint16p MutableNamedField[*uint16]
type MutableUint32 ¶ added in v1.0.0
type MutableUint32 MutableNamedField[uint32]
type MutableUint32p ¶ added in v1.0.0
type MutableUint32p MutableNamedField[*uint32]
type MutableUint64 ¶ added in v1.0.0
type MutableUint64 MutableNamedField[uint64]
type MutableUint64p ¶ added in v1.0.0
type MutableUint64p MutableNamedField[*uint64]
type MutableUint8 ¶ added in v1.0.0
type MutableUint8 MutableNamedField[uint8]
type MutableUint8p ¶ added in v1.0.0
type MutableUint8p MutableNamedField[*uint8]
type MutableUintp ¶ added in v1.0.0
type MutableUintp MutableNamedField[*uint]
type MutableUintptr ¶ added in v1.0.0
type MutableUintptr MutableNamedField[uintptr]
type MutableUintptrp ¶ added in v1.0.0
type MutableUintptrp MutableNamedField[*uintptr]
type ObjectEncoder ¶ added in v1.0.0
type ObjectEncoder = zapcore.ObjectEncoder
type ObjectMarshaler ¶
type ObjectMarshaler = zapcore.ObjectMarshaler
type Option ¶
type Option func(c *Config)
Option An Option configures a Log.
func WithAdapter ¶
WithAdapter with adapter file,console(default),multi,custom,file-custom,console-custom,multi-custom writer: 当 adapter=custom 使用,如果为writer为空,将使用os.Stdout
func WithEnableCompress ¶
func WithEnableCompress() Option
WithEnableCompress with compress 是否使用gzip压缩文件, 采用默认不压缩
func WithEnableLocalTime ¶
func WithEnableLocalTime() Option
WithEnableLocalTime with local time 是否格式化时间戳, 默认UTC时间
func WithEncodeLevel ¶
WithEncodeLevel with EncodeLevel LowercaseLevelEncoder(default): 小写编码器 LowercaseColorLevelEncoder: 小写编码器带颜色 CapitalLevelEncoder: 大写编码器 CapitalColorLevelEncoder: 大写编码器带颜色
func WithEncoderConfig ¶
func WithEncoderConfig(encoderConfig *zapcore.EncoderConfig) Option
EncoderConfig 如果配置该项,则 EncodeLevel 将被覆盖
func WithFilename ¶
WithFilename with filename 空字符使用默认, 默认<processname>-lumberjack.log
func WithFormat ¶
WithFormat with format json(default) or console
func WithMaxBackups ¶
WithMaxBackups with max backup 日志文件保存备份数, 默认0 都保存
func WithMaxSize ¶
WithMaxSize with max size 每个日志文件最大尺寸(MB), 默认100MB