log

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2016 License: Apache-2.0 Imports: 7 Imported by: 62

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	*log.Logger
	// contains filtered or unexported fields
}

Logger is an extended version of the golang Logger to support structured errors.

func New

func New(out io.Writer, prefix string, debug bool) *Logger

New creates a new Logger with no Log flags set.

func NewLogSet

func NewLogSet(prefix string, debug bool) (stderr, diagnostic, stdout *Logger)

NewLogSet returns a set of Loggers for commonly used output streams: errors, diagnostics, stdout. The error and stdout streams should generally never be suppressed. diagnostic can be suppressed by setting the output to ioutil.Discard. If an output destination is not needed, one can simply discard it by assigning it to '_'.

func (*Logger) Error

func (l *Logger) Error(e error)

Error is a convenience function for printing errors without a message.

func (*Logger) FatalE

func (l *Logger) FatalE(msg string, e error)

FatalE prints a string and error then calls os.Exit(1).

func (*Logger) PanicE

func (l *Logger) PanicE(msg string, e error)

PanicE prints a string and error then calls panic.

func (*Logger) PrintE

func (l *Logger) PrintE(msg string, e error)

PrintE prints the msg and its error message(s).

func (*Logger) SetDebug

func (l *Logger) SetDebug(b bool)

SetDebug sets the debug flag to the value of b

func (*Logger) SetFlags

func (l *Logger) SetFlags(flag int)

SetFlags is a wrapper around log.SetFlags that adds and removes, ": " to and from a prefix. This is needed because ": " is only added by golang's log package if either of the Lshortfile or Llongfile flags are set.

Jump to

Keyboard shortcuts

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