Version: v1.30.0 Latest Latest

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

Go to latest
Published: Apr 13, 2018 License: Apache-2.0 Imports: 7 Imported by: 63




This section is empty.


This section is empty.


This section is empty.


type Logger

type Logger struct {
	// 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) Errorf added in v1.20.0

func (l *Logger) Errorf(format string, a ...interface{})

Errorf is a convenience function for formatting and printing errors.

func (*Logger) FatalE

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

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

func (*Logger) Fatalf added in v1.20.0

func (l *Logger) Fatalf(format string, a ...interface{})

Fatalf prints an error then calls os.Exit(254).

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.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL