Documentation ¶
Overview ¶
Package encoders contains custom implementations of zap encoders.
Key Value encoder is an adaptation of zap's core JSON encoder. It's adapted so that it uses square brackets ([]) as field separators.
Original license applies as it is a copy with slight modifications. https://github.com/uber-go/zap/blob/f4243df/zapcore/json_encoder.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewKeyValueEncoder ¶
func NewKeyValueEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
NewKeyValueEncoder creates a fast, low-allocation logging encoder. The encoder appropriately escapes all field keys and values.
Note that the encoder doesn't deduplicate keys, so it's possible to produce a message like
[foo:bar][foo:baz]
Although this is permitted, it's not encouraged. Many libraries will ignore duplicate key-value pairs (typically keeping the last pair) when unmarshalling, so you should try to avoid adding duplicate keys.
Types ¶
This section is empty.