log

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: MIT Imports: 4 Imported by: 13

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

This section is empty.

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.

var DefaultLogger Logger

DefaultLogger is the default logger that only statemetns at the default level. The level is set by DefaultLevel inside init()..

func NewKitLogger

func NewKitLogger(opts ...lvl.Option) Logger

NewKitLogger returns a Logger based on go-kit/kit/log default logger structure that outputs to stdout. 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. By default, it wraps the logger with a SyncLogger so concurrent calls are synchronized.

func NewLogger

func NewLogger(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