debuglogger

package
v0.0.0-...-d8f7d12 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Upgrade

func Upgrade(logger log.Logger) log.DebugLogger

Upgrade will upgrade a log.Logger, adding methods for debug logs. If the provided logger is a log.DebugLogger, it is simply returned, otherwise the logger is wrapped in a new Logger.

Types

type Logger

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

func New

func New(logger log.Logger) *Logger

New will create a Logger from an existing log.Logger, adding methods for debug logs. Debug messages will be logged or ignored depending on their debug level. By default, the max debug level is -1, meaning all debug logs are dropped (ignored).

func (*Logger) Debug

func (l *Logger) Debug(level uint8, v ...interface{})

Debug will call the Print method if level is less than or equal to the max debug level for the Logger.

func (*Logger) Debugf

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

Debugf will call the Printf method if level is less than or equal to the max debug level for the Logger.

func (*Logger) Debugln

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

Debugln will call the Println method if level is less than or equal to the max debug level for the Logger.

func (*Logger) GetLevel

func (l *Logger) GetLevel() int16

GetLevel gets the current maximum debug level.

func (*Logger) SetLevel

func (l *Logger) SetLevel(maxLevel int16)

SetLevel sets the maximum debug level. A negative level will cause all debug messages to be dropped.

Jump to

Keyboard shortcuts

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