log

package
v1.32.2-hotfix.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2020 License: BSD-2-Clause Imports: 5 Imported by: 46

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithField added in v1.31.0

func ContextWithField(ctx context.Context, key string, value interface{}) context.Context

func ContextWithFields added in v1.31.0

func ContextWithFields(ctx context.Context, fields Fields) context.Context

func NewContextWithLogger added in v1.20.0

func NewContextWithLogger(ctx context.Context, logger Logger) context.Context

Types

type Fields

type Fields map[string]interface{}

type Level added in v1.20.0

type Level string
const (
	DebugLevel Level = "debug"
	InfoLevel  Level = "info"
	WarnLevel  Level = "warn"
	ErrorLevel Level = "error"
)

func DefaultLevel added in v1.20.0

func DefaultLevel() Level

type LevelRanks added in v1.20.0

type LevelRanks map[Level]Rank

func DefaultLevelRanks added in v1.20.0

func DefaultLevelRanks() LevelRanks

type Logger

type Logger interface {
	Log(level Level, message string)

	Debug(message string)
	Info(message string)
	Warn(message string)
	Error(message string)

	Debugf(message string, args ...interface{})
	Infof(message string, args ...interface{})
	Warnf(message string, args ...interface{})
	Errorf(message string, args ...interface{})

	WithError(err error) Logger

	WithField(key string, value interface{}) Logger
	WithFields(fields Fields) Logger

	WithLevelRank(level Level, rank Rank) Logger
	WithLevelRanks(levelRanks LevelRanks) Logger

	WithLevel(level Level) Logger

	Level() Level
}

func ContextAndLoggerWithField added in v1.31.0

func ContextAndLoggerWithField(ctx context.Context, key string, value interface{}) (context.Context, Logger)

func ContextAndLoggerWithFields added in v1.31.0

func ContextAndLoggerWithFields(ctx context.Context, fields Fields) (context.Context, Logger)

func LoggerFromContext added in v1.20.0

func LoggerFromContext(ctx context.Context) Logger

func NewLogger

func NewLogger(serializer Serializer, levelRanks LevelRanks, level Level) (Logger, error)

type Rank added in v1.20.0

type Rank int

type Serializer added in v1.20.0

type Serializer interface {
	Serialize(fields Fields) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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