log

package
v0.0.0-...-7946c9e Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2018 License: AGPL-3.0 Imports: 1 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context is simplified version of go-kit log Context https://godoc.org/github.com/go-kit/kit/log#Context.

func NewContext

func NewContext(logger Logger) *Context

NewContext returns a logger that adds prefix before keyvals.

func (*Context) Log

func (c *Context) Log(keyvals ...interface{}) error

Log adds prefix and suffix to keyvals and calls internal logger.

func (*Context) With

func (c *Context) With(keyvals ...interface{}) *Context

With returns a new Context with keyvals appended to those of the receiver.

func (*Context) WithPrefix

func (c *Context) WithPrefix(keyvals ...interface{}) *Context

WithPrefix returns a new Context with keyvals prepended to those of the receiver.

type Logger

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

Logger is the fundamental interface for all log operations. Log creates a log event from keyvals, a variadic sequence of alternating keys and values. Implementations must be safe for concurrent use by multiple goroutines. In particular, any implementation of Logger that appends to keyvals or modifies any of its elements must make a copy first.

func NewFilterLogger

func NewFilterLogger(logger Logger, level int) Logger

NewFilterLogger returns a Logger that accepts only log messages with "level" value <= level. Currently there are four levels 0 - error, 1 - info, 2 - debug, 3 - trace.

func NewNopLogger

func NewNopLogger() Logger

NewNopLogger returns a logger that doesn't do anything.

func NewStdLogger

func NewStdLogger() Logger

NewStdLogger returns logger based on standard "log" package.

Jump to

Keyboard shortcuts

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