log

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LogNone forbids any log entries
	LogNone int = iota
	// LogInfo sets the logging verbosity to info
	LogInfo
	// LogDebug sets the logging verbosity to debug
	LogDebug
)

Variables

View Source
var DefaultLevel = LogInfo

DefaultLevel is the default level where statements are logged. Change the value of this variable before init() to change the level of the default logger.

Functions

func LoggerTo added in v1.1.2

func LoggerTo(out io.Writer) log.Logger

LoggerTo provides a base logger to a specified output stream.

func SetDefaultLogger added in v1.1.2

func SetDefaultLogger(l log.Logger, level int)

SetDefaultLogger updates the default logger to wrap a provided kit logger.

Types

type Logger

type Logger interface {
	Info(keyvals ...interface{})
	Debug(keyvals ...interface{})
	Warn(keyvals ...interface{})
	Error(keyvals ...interface{})
	Fatal(keyvals ...interface{})
	// With returns a new Logger that inserts the given key value pairs for each
	// statements at each levels
	With(keyvals ...interface{}) Logger
}

Logger is a interface that can log to different levels.

func DefaultLogger

func DefaultLogger() Logger

DefaultLogger is the default logger that only logs at the `DefaultLevel`.

func NewKitLogger

func NewKitLogger(logger log.Logger, opts ...lvl.Option) Logger

NewKitLogger returns a Logger based on go-kit/kit/log default logger structure that outputs to stderr. You can pass in options to only allow certain levels. By default, it also includes the caller stack.

func NewKitLoggerFrom

func NewKitLoggerFrom(l log.Logger) Logger

NewKitLoggerFrom returns a Logger out of a go-kit/kit/log logger interface. The caller can set the options that it needs to the logger first. The underlying logger should already be synchronized.

func NewLogger

func NewLogger(l log.Logger, level int) Logger

NewLogger returns a kit logger that prints statements at the given level.

Jump to

Keyboard shortcuts

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