logging

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: Apache-2.0 Imports: 6 Imported by: 19

Documentation

Index

Constants

View Source
const Error = LogLevel("error")

Error sets level=error in the log output

View Source
const Fatal = LogLevel("fatal")

Fatal sets level=fatal in the log output

View Source
const Info = LogLevel("info")

Info is sets level=info in the log output

Variables

This section is empty.

Functions

This section is empty.

Types

type LogContext

type LogContext interface {
	LogContext() map[string]string
}

type LogLevel

type LogLevel string

LogLevel just wraps a string to be able to add LogContext specific to log levels

func (LogLevel) LogContext

func (l LogLevel) LogContext() map[string]string

LogContext returns the map that states that key value of `level={{l}}`

type Logger

type Logger interface {
	With(ctxs ...LogContext) Logger
	WithMap(mapCtx map[string]string) Logger
	WithKeyValue(key, value string) Logger

	Info() Logger
	Error() Logger
	Fatal() Logger

	Log(msg string)
	LogError(msg string, err error) error
	LogErrorF(format string, a ...interface{}) error
}

func NewBufferLogger

func NewBufferLogger() (*strings.Builder, Logger)

func NewDefaultLogger

func NewDefaultLogger() Logger

func NewLogger

func NewLogger(writer log.Logger) Logger

func NewNopLogger

func NewNopLogger() Logger

Jump to

Keyboard shortcuts

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