log

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateContext

func CreateContext(ctx context.Context, fields ...zap.Field) (context.Context, *zap.Logger)

CreateContext returns a new logger with the given fields tagged to the logger, and the context containing this logger.

func CreateContextNop

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

CreateContextNop adds a noop logger to the context.

func Debug

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

Debug writes a debug log with the default logger.

func Error

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

Error writes an error log with the default logger.

func Info

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

Info writes an info log with the default logger.

func Init

func Init(v bool)

Init initializes logging, based on we want verbose, or simple logs. Nonverbose logs go to a temporary file only, and the user get a nice message about everything from Info to Error.

func Panic

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

Panic writes a panic level log with the default logger, and then panics.

func Warn

func Warn(msg string, fields ...zap.Field)

Warn writes a warning log with the default logger.

Types

type Logger

type Logger struct {
	*zap.Logger
}

Logger is a wrapper for zap logger that may have custom functions on it.

func WithContext

func WithContext(ctx context.Context) Logger

WithContext returns a logger related to the given context.

func (Logger) Debug

func (l Logger) Debug(msg string, fields ...zap.Field)

Debug wraps printing a nice message to the user, and logging the debug to the zap logger.

func (Logger) Error

func (l Logger) Error(msg string, fields ...zap.Field)

Error wraps printing a nice message to the user, and logging the error to the zap logger.

func (Logger) Info

func (l Logger) Info(msg string, fields ...zap.Field)

Info wraps printing a nice message to the user, and logging the information to the zap logger.

func (Logger) Warn

func (l Logger) Warn(msg string, fields ...zap.Field)

Warn wraps printing a nice message to the user, and logging the warning to the zap logger.

Jump to

Keyboard shortcuts

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