logger

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: MIT Imports: 8 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config(i Logger)

func Log

func Log(c context.Context, l Level, message string, vals ...Pair)

func WithLevel

func WithLevel(c context.Context, l Level) context.Context

func WithValues

func WithValues(c context.Context, vals ...Pair) context.Context

Types

type DefaultLogger

type DefaultLogger struct {
	io.Writer
	Formatter Formatter
}

func (DefaultLogger) Log

func (dl DefaultLogger) Log(vals ...interface{}) error

type Formatter

type Formatter interface {
	Format(vals ...interface{}) string
}

type FormatterFunc

type FormatterFunc func(vals ...interface{}) string

func (FormatterFunc) Format

func (ff FormatterFunc) Format(vals ...interface{}) string

type Level

type Level int
const (
	OFF Level = iota
	TRACE
	DEBUG
	INFO
	WARN
	ERROR
	FATAL
)

func LevelFromContext added in v0.10.0

func LevelFromContext(c context.Context) (Level, bool)

func (Level) MarshalJSON

func (l Level) MarshalJSON() ([]byte, error)

func (Level) String

func (l Level) String() string

type Logger

type Logger interface {
	Log(vals ...interface{}) error
}

type LoggerFunc

type LoggerFunc func(vals ...interface{}) error

func (LoggerFunc) Log

func (lf LoggerFunc) Log(vals ...interface{}) error

type Pair

type Pair struct {
	Key   string
	Value interface{}
}

func ValuesFromContext added in v0.10.0

func ValuesFromContext(c context.Context) ([]Pair, bool)

Jump to

Keyboard shortcuts

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