encode

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DevConsoleConfig = &zapcore.EncoderConfig{
	MessageKey:     "message",
	LevelKey:       "level",
	EncodeLevel:    CapitalColorLevel,
	EncodeTime:     zapcore.ISO8601TimeEncoder,
	CallerKey:      "caller",
	EncodeCaller:   zapcore.ShortCallerEncoder,
	EncodeDuration: zapcore.SecondsDurationEncoder,
	StacktraceKey:  "stacktrace",
}

DevConsoleConfig is a bol.com tailored development optimized console encoder config

View Source
var JSONConfig = zapcore.EncoderConfig{
	MessageKey:     "@message",
	LevelKey:       "level",
	EncodeLevel:    zapcore.CapitalLevelEncoder,
	TimeKey:        "@timestamp",
	EncodeTime:     zapcore.ISO8601TimeEncoder,
	CallerKey:      "caller",
	EncodeCaller:   zapcore.ShortCallerEncoder,
	EncodeDuration: zapcore.SecondsDurationEncoder,
	StacktraceKey:  "stacktrace",
}

JSONConfig is a bol.com tailored production optimized json encoder config

View Source
var ProConsoleConfig = &zapcore.EncoderConfig{
	MessageKey:     "message",
	LevelKey:       "level",
	EncodeLevel:    zapcore.CapitalLevelEncoder,
	EncodeTime:     zapcore.ISO8601TimeEncoder,
	CallerKey:      "caller",
	EncodeCaller:   zapcore.ShortCallerEncoder,
	EncodeDuration: zapcore.SecondsDurationEncoder,
	StacktraceKey:  "stacktrace",
}

ProConsoleConfig is a bol.com tailored production optimized console encoder config

Functions

func CapitalColorLevel

func CapitalColorLevel(l zapcore.Level, enc zapcore.PrimitiveArrayEncoder)

CapitalColorLevel will apply coloring to the log level indicator

func ColorBytesForLevel

func ColorBytesForLevel(lvl zapcore.Level) (byte, byte)

ColorBytesForLevel returns the byte sequence used to color keys for console output

func ColorKey

func ColorKey(key string, level zapcore.Level) string

ColorKey will color the provided key at the associated log level color

Types

type Color

type Color uint8

Color represents a text color.

const (
	Black Color = iota + 30
	Red
	Green
	Yellow
	Blue
	Magenta
	Cyan
	White
)

Foreground colors.

func (Color) Add

func (c Color) Add(s string) string

Add adds the coloring to the given string.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL