log

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MaxLevel is the highest Level we will log (max TRACE, min ERROR)
	MaxLevel = TRACE
)

Functions

func AddTickerFunc added in v1.3.0

func AddTickerFunc(f TickerFunc)

AddTickerFunc adds a new function callback to the list of metrics TickerFuncs that get called each minute.

func Close

func Close()

Close the log file if we have one open

func Errorf

func Errorf(msg string, args ...interface{})

Errorf logs a message to the 'standard' Logger (always), accepts format strings

func Infof

func Infof(msg string, args ...interface{})

Infof logs a message to the 'standard' Logger if MaxLevel is >= INFO, accepts format strings

func Initialize

func Initialize(logfile string) error

Initialize logging. If logfile is equal to "stderr" or "stdout", then we will log to that output stream. Otherwise the specificed file will opened for writing, and all log data will be placed in it.

func PushMetric added in v1.3.0

func PushMetric(history *list.List, ev expvar.Var) string

PushMetric adds the metric to the end of the list and returns a comma separated string of the previous 61 entries. We return 61 instead of 60 (an hour) because the chart on the client tracks deltas between these values - there is nothing to compare the first value against.

func Rotate

func Rotate()

Rotate closes the current log file, then reopens it. This gives an external log rotation system the opportunity to move the existing log file out of the way and have Inbucket create a new one.

func SetLogLevel

func SetLogLevel(level string) (ok bool)

SetLogLevel sets MaxLevel based on the provided string

func Tracef

func Tracef(msg string, args ...interface{})

Tracef logs a message to the 'standard' Logger if MaxLevel is >= TRACE, accepts format strings

func Warnf

func Warnf(msg string, args ...interface{})

Warnf logs a message to the 'standard' Logger if MaxLevel is >= WARN, accepts format strings

Types

type Level

type Level int

Level is used to indicate the severity of a log entry

const (
	// ERROR indicates a significant problem was encountered
	ERROR Level = iota
	// WARN indicates something that may be a problem
	WARN
	// INFO indicates a purely informational log entry
	INFO
	// TRACE entries are meant for development purposes only
	TRACE
)

type TickerFunc added in v1.3.0

type TickerFunc func()

TickerFunc is the type of metrics function accepted by AddTickerFunc

Jump to

Keyboard shortcuts

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