Documentation ¶
Index ¶
- Variables
- func ColoredCapitalLevelEncoder(l zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
- func ColoredShortCallerEncoder(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder)
- func ColoredTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)
- func ColoredTimeEncoderWithLayout(layout string) zapcore.TimeEncoder
- func Default() *zap.Logger
- func New() *zap.Logger
- func NewColoredConsoleEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
- func NewRotateLogger(tops []TeeOption, ops ...Option) *zap.Logger
- func RegisterColorConsoleEncoder()
- func ResetDefault(l *zap.Logger)
- func Sync() error
- type Color
- type ColoredConsoleEncoder
- type Field
- type Level
- type LevelEnablerFunc
- type Option
- type Rotation
- type TeeOption
Constants ¶
This section is empty.
Variables ¶
var ( Skip = zap.Skip Binary = zap.Binary Bool = zap.Bool Boolp = zap.Boolp ByteString = zap.ByteString Complex128 = zap.Complex128 Complex128p = zap.Complex128p Complex64 = zap.Complex64 Complex64p = zap.Complex64p Float64 = zap.Float64 Float64p = zap.Float64p Float32 = zap.Float32 Float32p = zap.Float32p Int = zap.Int Intp = zap.Intp Int64 = zap.Int64 Int64p = zap.Int64p Int32 = zap.Int32 Int32p = zap.Int32p Int16 = zap.Int16 Int16p = zap.Int16p Int8 = zap.Int8 Int8p = zap.Int8p String = zap.String Stringp = zap.Stringp Uint = zap.Uint Uintp = zap.Uintp Uint64 = zap.Uint64 Uint64p = zap.Uint64p Uint32 = zap.Uint32 Uint32p = zap.Uint32p Uint16 = zap.Uint16 Uint16p = zap.Uint16p Uint8 = zap.Uint8 Uint8p = zap.Uint8p Uintptr = zap.Uintptr Uintptrp = zap.Uintptrp Reflect = zap.Reflect Namespace = zap.Namespace Stringer = zap.Stringer Time = zap.Time Timep = zap.Timep Stack = zap.Stack StackSkip = zap.StackSkip Duration = zap.Duration Durationp = zap.Durationp Any = zap.Any )
Zlog Field Definition
var ( Info = std.Info Warn = std.Warn Error = std.Error DPanic = std.DPanic Fatal = std.Fatal Debug = std.Debug )
Logger function alias
var ( WithCaller = zap.WithCaller WithTrace = zap.AddStacktrace )
Logger Option
var DefaultRotation = func(filename string) Rotation { return Rotation{ Filename: filename, MaxSize: 2 << 10, MaxAge: 7, MaxBackups: 5, Compress: true, LocalTime: true, } }
DefaultRotation with default rotate option. MaxSize: 2GB MaxBackups: 5 MaxAge: 7 days
var Sugar = std.Sugar
Sugar for std logger
Functions ¶
func ColoredCapitalLevelEncoder ¶
func ColoredCapitalLevelEncoder(l zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
ColoredCapitalLevelEncoder for colored capital level
func ColoredShortCallerEncoder ¶
func ColoredShortCallerEncoder(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder)
ColoredShortCallerEncoder for colored shortCallerEncoder
func ColoredTimeEncoder ¶
func ColoredTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)
ColoredTimeEncoder custom encoder for time field
func ColoredTimeEncoderWithLayout ¶
func ColoredTimeEncoderWithLayout(layout string) zapcore.TimeEncoder
ColoredTimeEncoderWithLayout custom encoder for time field with a layout
func NewColoredConsoleEncoder ¶
func NewColoredConsoleEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
NewColoredConsoleEncoder create ColoredConsoleEncoder instance
func NewRotateLogger ¶
NewRotateLogger create rotate logger instance
func RegisterColorConsoleEncoder ¶
func RegisterColorConsoleEncoder()
RegisterColorConsoleEncoder register an encoder constructor for zapcore
Types ¶
type ColoredConsoleEncoder ¶
type ColoredConsoleEncoder struct { *zapcore.EncoderConfig zapcore.Encoder }
ColoredConsoleEncoder encode logger entry with color
func (ColoredConsoleEncoder) EncodeEntry ¶
func (c ColoredConsoleEncoder) EncodeEntry( entry zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)
EncodeEntry encode each log field
type Level ¶
Level zlog logger level
const ( DebugLevel Level = zap.DebugLevel InfoLevel Level = zap.InfoLevel WarnLevel Level = zap.WarnLevel ErrorLevel Level = zap.ErrorLevel DPanicLevel Level = zap.DPanicLevel PanicLevel Level = zap.PanicLevel FatalLevel Level = zap.PanicLevel )
Zlog Logger Level
type LevelEnablerFunc ¶
type LevelEnablerFunc = zap.LevelEnablerFunc
LevelEnablerFunc implement LevelEnabler
type TeeOption ¶
type TeeOption struct { Rotation Rotation LevelFunc LevelEnablerFunc }
TeeOption for writer syncer