logger

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: Apache-2.0 Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debugf

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

Debugf logs events labeled with DEBUG severity.

func Errorf

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

Errorf logs events labeled with ERROR severity.

func Fatalf

func Fatalf(format string, args ...interface{})

Fatalf logs the message and internally will call os.Exit(1). This log level cannot be overridden by configuration changes.

func Info

func Info(format string)

Info logs events labeled with INFO severity.

func Infof

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

Infof logs events labeled with INFO severity.

func Panicf

func Panicf(format string, args ...interface{})

Panicf logs the message and internally will call panic() using the message as an argument. This log level cannot be overridden by configuration changes.

func SetLevel

func SetLevel(v Verbosity)

func SetLoggerImpl

func SetLoggerImpl(newLogger Logger)

SetLoggerImpl lets you override the Logger implementation. Calls are not thread-safe, so set this first thing at application start.

func Warningf

func Warningf(format string, args ...interface{})

Warningf logs events labeled with WARNING severity.

Types

type Logger

type Logger interface {
	// Debugf logs events labeled with DEBUG severity.
	Debugf(format string, args ...interface{})

	// Infof logs events labeled with INFO severity.
	Infof(format string, args ...interface{})

	// Info logs events labeled with INFO severity.
	Info(format string)

	// Warningf logs events labeled with WARNING severity.
	Warningf(format string, args ...interface{})

	// Errorf logs events labeled with ERROR severity.
	Errorf(format string, args ...interface{})

	// Fatalf logs the message and internally will call os.Exit(1).  This log
	// level cannot be overridden by configuration changes.
	//
	// Any implementation of this interface MUST call os.Exit(1) internally.
	Fatalf(format string, args ...interface{})

	// Panicf logs the message and internally will call panic() using the
	// message as an argument.  This log level cannot be overridden by
	// configuration changes.
	//
	// Any implementation of this interface MUST call panic() internally.
	Panicf(format string, args ...interface{})
}

Logger provides a general interface for generic logging functionality. Implementers who want to utilize a different logging library/strategy can use this interface to plug in a different implementation.

type StandardGolangLogger

type StandardGolangLogger struct {
	VerbosityLevel Verbosity
}

func (*StandardGolangLogger) Debugf

func (l *StandardGolangLogger) Debugf(format string, args ...interface{})

func (*StandardGolangLogger) Errorf

func (l *StandardGolangLogger) Errorf(format string, args ...interface{})

func (*StandardGolangLogger) Fatalf

func (l *StandardGolangLogger) Fatalf(format string, args ...interface{})

func (*StandardGolangLogger) Info

func (l *StandardGolangLogger) Info(format string)

func (*StandardGolangLogger) Infof

func (l *StandardGolangLogger) Infof(format string, args ...interface{})

func (*StandardGolangLogger) Panicf

func (l *StandardGolangLogger) Panicf(format string, args ...interface{})

func (*StandardGolangLogger) Warningf

func (l *StandardGolangLogger) Warningf(format string, args ...interface{})

type Verbosity

type Verbosity int
const (
	DEBUG Verbosity = iota - 1
	INFO
	WARNING
	ERROR
	FATAL
	PANIC
)

func GetLevelFromString

func GetLevelFromString(s string) Verbosity

Jump to

Keyboard shortcuts

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