zap

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Modified from: https://github.com/uber-go/zap/blob/7b21229fb3f063275f4f169f8a79ad30aa001c51/zapcore/console_encoder.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompactColorLevelEncoder

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

CompactColorLevelEncoder serializes a Level to a compact string and adds coloring. For example, InfoLevel is serialized to "I" and colored blue.

func CompactLevelEncoder

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

CompactLevelEncoder serializes a Level to a compact string. For example, InfoLevel is serialized to "I".

func NewCompactEncoder

func NewCompactEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder

NewCompactEncoder 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 compact plain-text format and leaves the structured context as JSON. It's outputs look like:

D[2021-05-13T17:49:52.413+0800] example/log.go:52 for Debug I[2021-05-13T17:49:52.413+0800] example/log.go:52 for Info W[2021-05-13T17:49:52.413+0800] example/log.go:52 for Warn E[2021-05-13T17:49:52.413+0800] example/log.go:52 for Error p[2021-05-13T17:49:52.413+0800] example/log.go:52 for DPanic P[2021-05-13T17:49:52.413+0800] example/log.go:52 for Panic F[2021-05-13T17:49:52.413+0800] example/log.go:52 for Fatal

Note that although the compact encoder doesn't use the keys specified in the encoder configuration, it will omit any element whose key is set to the empty string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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