logging

package
v0.0.0-...-bd4e2c0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLevel

type LogLevel int
const (
	LevelDebug LogLevel = iota
	LevelInfo
	LevelWarn
	LevelError
)

type Logger

type Logger interface {
	// Log is invoked with the log level, the log message, and key/value pairs
	// of any relevant log details. The keys are always strings, while the
	// values are unspecified.
	Log(level LogLevel, text string, args ...interface{})
}

Logger is minimal logging interface designed to be easily adaptable to any logging library.

var (
	// ConsoleDebugLogger implements Logger and writes all log messages to stdout.
	ConsoleDebugLogger Logger = consoleLogger(LevelDebug)

	// ConsoleInfoLogger implements Logger and writes all LevelInfo and above log messages to stdout.
	ConsoleInfoLogger Logger = consoleLogger(LevelInfo)

	// ConsoleWarnLogger implements Logger and writes all LevelWarn and above log messages to stdout.
	ConsoleWarnLogger Logger = consoleLogger(LevelWarn)

	// ConsoleErrorLogger implements Logger and writes all LevelError log messages to stdout.
	ConsoleErrorLogger Logger = consoleLogger(LevelError)

	// NilLogger drops all log messages.
	NilLogger Logger = &nilLogger{}
)

func Decorate

func Decorate(logger Logger, prefix string, args ...interface{}) Logger

func Synchronize

func Synchronize(logger Logger) Logger

Jump to

Keyboard shortcuts

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