Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMixedEncoder ¶
func NewMixedEncoder(formatter ...MixedFormatter) zap.Encoder
NewMixedEncoder creates a fast, low-allocation JSON encoder. By default, JSON encoders put the log message under the "msg" key, the timestamp (as floating-point seconds since epoch) under the "ts" key, and the log level under the "level" key. 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"}
This is permitted by the JSON specification, but not encouraged. Many libraries will ignore duplicate key-value pairs (typically keeping the last pair) when unmarshaling, but users should attempt to avoid adding duplicate keys.
Types ¶
type FileOutput ¶
with external rotate support
func File ¶
func File(path string) (*FileOutput, error)
func (*FileOutput) Close ¶
func (r *FileOutput) Close() (err error)
func (*FileOutput) Sync ¶
func (r *FileOutput) Sync() (err error)