logging

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2018 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enabled

func Enabled() bool

Enabled is a predicate stating if logging is enabled. It has to be usable after flags init but _before_ implSetup, being called by Setup() in core.go to decide if we should be called.

Types

type Logger

type Logger interface {
	WithField(key string, value interface{}) Logger
	WithError(err error) Logger

	// while logrus uses `args ...interface{}`, we push hard enough for
	// structured logging that not only do we not use any of the Foof()
	// variants, but we also only ever call these with one item, a string
	// message for the humans.  EVERYTHING else in our usage must be properly
	// structured, under some key.
	Debug(message string)
	Info(message string)
	Warning(message string)
	Error(message string)

	// IsDisabled is a simple one-liner which real implementations should use
	// to return false, unless they support the concept of disabling.
	IsDisabled() bool
}

Logger is the interface API which the rest of our code should use for logging. Originally this was a type alias for logrus.FieldLogger, but we now enumerate for ourselves exactly what we do rely upon, so that we have a smaller surface and can drop something else in. As we now do, under certain build tags.

func NilLogger added in v0.0.6

func NilLogger() Logger

NilLogger returns a typed nil which satisfies Logger but does nothing.

func Setup

func Setup() Logger

Setup is used to setup logging.

Jump to

Keyboard shortcuts

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