log

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StdLogger = New(false)

StdLogger is the logger that is used from the log functions in this package

Functions

func DebugEnabled

func DebugEnabled() bool

DebugEnabled returns true if the Stdlogger logs debug messages

func Debugf

func Debugf(format string, v ...interface{})

Debugf logs a debug message to stdout. It's only shown if debugging is enabled.

func Debugln

func Debugln(v ...interface{})

Debugln logs a debug message to stdout. It's only shown if debugging is enabled.

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger logs messages

func New

func New(debugEnabled bool) *Logger

New returns a new Logger that logs to Stderr. Debug messages are only printed if debugEnabled is true

func (*Logger) DebugEnabled

func (l *Logger) DebugEnabled() bool

DebugEnabled returns true if logging debug messages is enabled

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

Debugf logs a debug message to stdout. It's only shown if debugging is enabled.

func (*Logger) Debugln

func (l *Logger) Debugln(v ...interface{})

Debugln logs a debug message to stdout. It's only shown if debugging is enabled.

func (*Logger) EnableDebug

func (l *Logger) EnableDebug(enabled bool)

EnableDebug enables/disables logging debug messages

func (*Logger) GetOutput

func (l *Logger) GetOutput() Output

GetOutput returns the output to which log messages are written.

func (*Logger) SetOutput

func (l *Logger) SetOutput(o Output)

SetOutput changes the output of the logger

type Output

type Output interface {
	Printf(format string, v ...interface{})
	Println(v ...interface{})
}

Output defines the output channel of a logger to that all log messages are written.

type TestLogOutput

type TestLogOutput struct {
	// contains filtered or unexported fields
}

func NewTestLogOutput

func NewTestLogOutput(t *testing.T) *TestLogOutput

NewTestLogOutput wraps the logger of testing.T to provide the Output interface.

func (*TestLogOutput) Printf

func (l *TestLogOutput) Printf(format string, v ...interface{})

func (*TestLogOutput) Println

func (l *TestLogOutput) Println(v ...interface{})

Jump to

Keyboard shortcuts

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