log

package
v0.0.0-...-1d8daf6 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Any

func Any(key string, val interface{}) zapcore.Field

Any return zapcore field based on type of val

func Debug

func Debug(msg string, f ...zap.Field)

Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func Err

func Err(err error) zapcore.Field

Err is the error field

func Error

func Error(msg string, f ...zap.Field)

Error logs a message at ErrorLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func Fatal

func Fatal(msg string, f ...zap.Field)

Fatal logs a message at FatalLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

The logger then calls os.Exit(1), even if logging at FatalLevel is disabled.

func Info

func Info(msg string, f ...zap.Field)

Info logs a message at InfoLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func Init

func Init(ctx context.Context, debug bool) error

func Logger

func Logger() *zap.Logger

func NewForTest

func NewForTest() (*zap.Logger, *observer.ObservedLogs)

NewForTest returns a new logger and the corresponding observed logs which can be used in unit tests to verify log entries.

func Panic

func Panic(msg string, f ...zap.Field)

Panic logs a message at PanicLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

The logger then panics, even if logging at PanicLevel is disabled.

func String

func String(key, val string) zapcore.Field

String is a wrapper for zap string field

func Time

func Time(key string, val time.Time) zapcore.Field

Time constructs a Field with the given key and value. The encoder controls how the time is serialized.

func With

func With(f ...zap.Field) *zap.Logger

With creates a child logger and adds structured context to it. Fields added to the child don't affect the parent, and vice versa.

Types

This section is empty.

Jump to

Keyboard shortcuts

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