Documentation

Index

Constants

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

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

func LoggerTo(out io.Writer) log.Logger

LoggerTo provides a base logger to a specified output stream.

func SetDefaultLogger

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.

Source Files