log

package
v0.1.82 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Any added in v0.1.1

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

Any return zapcore field based on type of val

func Debug added in v0.1.1

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 added in v0.1.1

func Err(err error) zapcore.Field

Err is the error field

func Error added in v0.1.1

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 added in v0.1.1

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 added in v0.1.1

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 added in v0.1.1

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

Init initialize logger, if debug set to true zap.NewDevelopment will use to create a zap logger otherwise zap.NewProduction will use

func Logger

func Logger() *zap.Logger

Logger will return a pointer to zap logger instance

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 added in v0.1.1

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 added in v0.1.1

func String(key, val string) zapcore.Field

String is a wrapper for zap string field

func Time added in v0.1.1

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 added in v0.1.1

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