log

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultJSONEncoder

func DefaultJSONEncoder() (encoder zapcore.Encoder)

DefaultJSONEncoder Create a new JSON log encoder with the correct settings.

func Error

func Error(ctx context.Context, err error) error

func Logger

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

Logger returns logger which associated context

func NewLogger

func NewLogger(conf Config, encoder zapcore.Encoder) (logger *zap.Logger, err error)

NewLogger initializes log by input parameters lvl - global log level: Debug(-1), Info(0), Warn(1), Error(2), DPanic(3), Panic(4), Fatal(5) timeFormat - custom time format for logger of empty string to use default

func WithLogger

func WithLogger(ctx context.Context, fields ...zap.Field) context.Context

WithLogger returns context which contains logger

Types

type Config

type Config interface {
	IsLocal() bool
	GetLevel() zapcore.Level
}

Jump to

Keyboard shortcuts

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