Documentation ¶
Index ¶
- Constants
- 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 NewColoredConsoleEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
- func RegisterColorConsoleEncoder()
- func Setting() *zap.Logger
- func Sync()
- func WithCustomEncoder(config zapcore.EncoderConfig)
- type Color
- type ColoredConsoleEncoder
Constants ¶
View Source
const ( JSONEncoderName = "json-prom" ConsoleEncoderName = "console-prom" )
Prometheus Encoders
Variables ¶
View Source
var Sugar *zap.SugaredLogger
Sugar for default 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 RegisterColorConsoleEncoder ¶
func RegisterColorConsoleEncoder()
RegisterColorConsoleEncoder register an encoder constructor for zapcore
func Sync ¶
func Sync()
Sync calls zap Sync method to flush buffered log entries. Applications should take care to call Sync before exit.
func WithCustomEncoder ¶
func WithCustomEncoder(config zapcore.EncoderConfig)
WithCustomEncoder set custom encoder for encoder config
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
Click to show internal directories.
Click to hide internal directories.