logger

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2016 License: MIT Imports: 3 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLevel

type LogLevel int

LogLevel represents the levels at which logs are written and rendered.

const (
	DEBUG LogLevel = iota
	INFO
	ERROR
	FATAL
)

DEBUG < INFO < ERROR < FATAL

func LogLevelFromString

func LogLevelFromString(logLevel string) LogLevel

LogLevelFromString returns a LogLevel for the provided logLevel string. It will panic if an unknown logLevel is provided.

type Logger

type Logger interface {
	Info(string, ...interface{})
	Debug(string, ...interface{})
	Error(string, error, ...interface{})
}

Logger supports writing messages and arbitrary data at different log levels.

func NewLogger

func NewLogger(minLogLevel LogLevel) Logger

NewLogger returns a logger writing to stdout whose level is controlled by the provided minLogLevel

func NewTestLogger

func NewTestLogger(writer io.Writer) Logger

NewTestLogger returns a logger writing to the provided writer. Its level is fixed at DEBUG It is primarily used in testing to write to e.g. the GinkgoWriter

type Sink

type Sink interface {
	//Log to the sink.  Best effort -- no need to worry about errors.
	Log(level LogLevel, payload []byte)
}

A Sink represents a write destination for a Logger. Based off https://github.com/pivotal-golang/lager

Jump to

Keyboard shortcuts

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