logger

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DEBUG  = "DEBUG"
	INFO   = "INFO"
	WARN   = "WARN"
	ERROR  = "ERROR"
	DPanic = "DPANIC"
	PANIC  = "PANIC"
	FATAL  = "FATAL"
)

Variables

View Source
var (
	LogSizeM   = 20
	MaxZip     = 50
	MaxLogDays = 30
)

Functions

func From

func From(ctx context.Context) *zap.Logger

func New

func New(opts ...Option) *zap.Logger

func NewConsoleEncoder

func NewConsoleEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder

nolint:gocritic

NewJSONEncoder creates a fast, low-allocation JSON 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"}

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.

func SetWriter

func SetWriter(path string) io.Writer

SetWriter return a io.Writer

func With

func With(ctx context.Context, l *zap.Logger) context.Context

Types

type Option

type Option func(*option)

func WithEncoder

func WithEncoder(encoder func(zapcore.EncoderConfig) zapcore.Encoder) Option

func WithFields

func WithFields(fields ...zap.Field) Option

func WithLevel

func WithLevel(level string) Option

func WithSkip

func WithSkip(skip int) Option

func WithWriter

func WithWriter(w io.Writer) Option

Jump to

Keyboard shortcuts

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