logger

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultVerbosity = HighVerbosity

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultLogger

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

DefaultLogger is the package's built-in logger. It uses log.Default() as the underlying logger.

func NewDefaultLogger

func NewDefaultLogger() *DefaultLogger

NewDefaultLogger creates an instance of DefaultLogger with the highest verbosity.

func NewDefaultLoggerWithVerbosity

func NewDefaultLoggerWithVerbosity(verbosity Verbosity) *DefaultLogger

NewDefaultLoggerWithVerbosity creates an instance of DefaultLogger with a user-defined verbosity.

func (*DefaultLogger) Debugf

func (df *DefaultLogger) Debugf(format string, o ...interface{})

Debugf writes a debug message to the log (only if DefaultLogger verbosity is set to HighVerbosity)

func (*DefaultLogger) Errorf

func (df *DefaultLogger) Errorf(err error, format string, o ...interface{})

Errorf writes an error message to the log (regardless of DefaultLogger's verbosity)

func (*DefaultLogger) Infof

func (df *DefaultLogger) Infof(format string, o ...interface{})

Infof writes an informative message to the log (only if DefaultLogger verbosity is set to HighVerbosity)

func (*DefaultLogger) Warnf

func (df *DefaultLogger) Warnf(format string, o ...interface{})

Warnf writes a warning message to the log (unless DefaultLogger verbosity is set to LowVerbosity)

type Logger

type Logger interface {
	Debugf(format string, o ...interface{})
	Infof(format string, o ...interface{})
	Warnf(format string, o ...interface{})
	Errorf(err error, format string, o ...interface{})
}

The Logger interface defines the API for loggers in this package.

type Verbosity

type Verbosity int

Verbosity is an enumerated type for defining the level of verbosity.

const (
	LowVerbosity Verbosity = iota
	MediumVerbosity
	HighVerbosity
)

Jump to

Keyboard shortcuts

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