log

package
v1.29.0-mobile.6 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2018 License: BSD-2-Clause Imports: 5 Imported by: 46

Documentation

Index

Constants

View Source
const TimeFormat = "2006-01-02T15:04:05.999Z07:00"

Variables

This section is empty.

Functions

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 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