encoders

package
v0.0.0-...-2bef83c Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2019 License: MIT Imports: 8 Imported by: 0

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.

Jump to

Keyboard shortcuts

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