Documentation
¶
Overview ¶
Package logger logger/console_encoder.go
Index ¶
- Variables
- func Debug(msg string, fields ...zap.Field)
- func Error(msg string, fields ...zap.Field)
- func ErrorAndExit(msg string, err error)
- func ErrorErr(msg string, err error)
- func Info(msg string, fields ...zap.Field)
- func LogIf(err error, fields ...zap.Field)
- func NewFancyEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
- func SetupLogger(configPath string) (err error)
- func Warn(msg string, fields ...zap.Field)
- type FancyEncoder
- func (e *FancyEncoder) AddArray(key string, marshaler zapcore.ArrayMarshaler) error
- func (e *FancyEncoder) AddBinary(key string, value []byte)
- func (e *FancyEncoder) AddBool(key string, value bool)
- func (e *FancyEncoder) AddByteString(key string, value []byte)
- func (e *FancyEncoder) AddComplex64(key string, value complex64)
- func (e *FancyEncoder) AddComplex128(key string, value complex128)
- func (e *FancyEncoder) AddDuration(key string, value time.Duration)
- func (e *FancyEncoder) AddFloat32(key string, value float32)
- func (e *FancyEncoder) AddFloat64(key string, value float64)
- func (e *FancyEncoder) AddInt(key string, value int)
- func (e *FancyEncoder) AddInt8(key string, value int8)
- func (e *FancyEncoder) AddInt16(key string, value int16)
- func (e *FancyEncoder) AddInt32(key string, value int32)
- func (e *FancyEncoder) AddInt64(key string, value int64)
- func (e *FancyEncoder) AddObject(key string, marshaler zapcore.ObjectMarshaler) error
- func (e *FancyEncoder) AddReflected(key string, value interface{}) error
- func (e *FancyEncoder) AddString(key string, value string)
- func (e *FancyEncoder) AddTime(key string, value time.Time)
- func (e *FancyEncoder) AddUint(key string, value uint)
- func (e *FancyEncoder) AddUint8(key string, value uint8)
- func (e *FancyEncoder) AddUint16(key string, value uint16)
- func (e *FancyEncoder) AddUint32(key string, value uint32)
- func (e *FancyEncoder) AddUint64(key string, value uint64)
- func (e *FancyEncoder) AddUintptr(key string, value uintptr)
- func (e *FancyEncoder) Clone() zapcore.Encoder
- func (e *FancyEncoder) EncodeEntry(entry zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)
- func (e *FancyEncoder) OpenNamespace(key string)
Constants ¶
This section is empty.
Variables ¶
View Source
var Logger *zap.Logger
Logger 全局日志实例
Functions ¶
func ErrorAndExit ¶
ErrorAndExit @Description 报错并退出应用(非常危险!) @Author CuratorC 2026-03-18 11:18:19 @Param msg @Param err
func LogIf ¶
LogIf @Description 非空 err 时记录 Error 级别日志并附带调用栈 @Param err error @Param fields ...zap.Field 额外的日志字段
func NewFancyEncoder ¶
func NewFancyEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
NewFancyEncoder @Description 创建美化控制台编码器 @Author CuratorC 2026-03-19 10:31:00 @Param cfg zapcore.EncoderConfig @Return zapcore.Encoder
Types ¶
type FancyEncoder ¶
type FancyEncoder struct {
zapcore.EncoderConfig
}
FancyEncoder @Description 美化的控制台日志编码器 @Author CuratorC 2026-03-19 10:31:00
func (*FancyEncoder) AddArray ¶
func (e *FancyEncoder) AddArray(key string, marshaler zapcore.ArrayMarshaler) error
func (*FancyEncoder) AddBinary ¶
func (e *FancyEncoder) AddBinary(key string, value []byte)
func (*FancyEncoder) AddBool ¶
func (e *FancyEncoder) AddBool(key string, value bool)
func (*FancyEncoder) AddByteString ¶
func (e *FancyEncoder) AddByteString(key string, value []byte)
func (*FancyEncoder) AddComplex64 ¶
func (e *FancyEncoder) AddComplex64(key string, value complex64)
func (*FancyEncoder) AddComplex128 ¶
func (e *FancyEncoder) AddComplex128(key string, value complex128)
func (*FancyEncoder) AddDuration ¶
func (e *FancyEncoder) AddDuration(key string, value time.Duration)
func (*FancyEncoder) AddFloat32 ¶
func (e *FancyEncoder) AddFloat32(key string, value float32)
func (*FancyEncoder) AddFloat64 ¶
func (e *FancyEncoder) AddFloat64(key string, value float64)
func (*FancyEncoder) AddInt ¶
func (e *FancyEncoder) AddInt(key string, value int)
func (*FancyEncoder) AddInt8 ¶
func (e *FancyEncoder) AddInt8(key string, value int8)
func (*FancyEncoder) AddInt16 ¶
func (e *FancyEncoder) AddInt16(key string, value int16)
func (*FancyEncoder) AddInt32 ¶
func (e *FancyEncoder) AddInt32(key string, value int32)
func (*FancyEncoder) AddInt64 ¶
func (e *FancyEncoder) AddInt64(key string, value int64)
func (*FancyEncoder) AddObject ¶
func (e *FancyEncoder) AddObject(key string, marshaler zapcore.ObjectMarshaler) error
func (*FancyEncoder) AddReflected ¶
func (e *FancyEncoder) AddReflected(key string, value interface{}) error
func (*FancyEncoder) AddString ¶
func (e *FancyEncoder) AddString(key string, value string)
func (*FancyEncoder) AddUint ¶
func (e *FancyEncoder) AddUint(key string, value uint)
func (*FancyEncoder) AddUint8 ¶
func (e *FancyEncoder) AddUint8(key string, value uint8)
func (*FancyEncoder) AddUint16 ¶
func (e *FancyEncoder) AddUint16(key string, value uint16)
func (*FancyEncoder) AddUint32 ¶
func (e *FancyEncoder) AddUint32(key string, value uint32)
func (*FancyEncoder) AddUint64 ¶
func (e *FancyEncoder) AddUint64(key string, value uint64)
func (*FancyEncoder) AddUintptr ¶
func (e *FancyEncoder) AddUintptr(key string, value uintptr)
func (*FancyEncoder) Clone ¶
func (e *FancyEncoder) Clone() zapcore.Encoder
func (*FancyEncoder) EncodeEntry ¶
func (*FancyEncoder) OpenNamespace ¶
func (e *FancyEncoder) OpenNamespace(key string)
Click to show internal directories.
Click to hide internal directories.