MCPcopy
hub / github.com/uber-go/zap / NewConsoleEncoder

Function NewConsoleEncoder

zapcore/console_encoder.go:58–64  ·  view source on GitHub ↗

NewConsoleEncoder creates an encoder whose output is designed for human - rather than machine - consumption. It serializes the core log entry data (message, level, timestamp, etc.) in a plain-text format and leaves the structured context as JSON. Note that although the console encoder doesn't use t

(cfg EncoderConfig)

Source from the content-addressed store, hash-verified

56// encoder configuration, it will omit any element whose key is set to the empty
57// string.
58func NewConsoleEncoder(cfg EncoderConfig) Encoder {
59 if cfg.ConsoleSeparator == "" {
60 // Use a default delimiter of '\t' for backwards compatibility
61 cfg.ConsoleSeparator = "\t"
62 }
63 return consoleEncoder{newJSONEncoder(cfg, true)}
64}
65
66func (c consoleEncoder) Clone() Encoder {
67 return consoleEncoder{c.jsonEncoder.Clone().(*jsonEncoder)}

Callers 9

encoder.goFile · 0.92
withLoggerFunction · 0.92
NewLoggerFunction · 0.92
BenchmarkZapConsoleFunction · 0.85
TestConsoleEncodeEntryFunction · 0.85
TestConsoleSeparatorFunction · 0.85
TestEncoderConfigurationFunction · 0.85

Calls 1

newJSONEncoderFunction · 0.85

Tested by 7

withLoggerFunction · 0.74
BenchmarkZapConsoleFunction · 0.68
TestConsoleEncodeEntryFunction · 0.68
TestConsoleSeparatorFunction · 0.68
TestEncoderConfigurationFunction · 0.68