logging

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DebugLogger *log.Logger
	InfoLogger  *log.Logger
	WarnLogger  *log.Logger
	ErrorLogger *log.Logger
	FatalLogger *log.Logger

	// Suppress output by default when tests are being run
	IsTesting bool
)

Several of these vars are exported intentionally, so callers can access & override values during their tests or runtimes. For example, a caller whose functions call FatalLog() in the call stack may want to be able to disable IsTesting to emit logs, redirect log output to a buffer, and match against that output (e.g. rhad has tests like this)

Functions

func Debug added in v0.6.0

func Debug(msg string, values ...any)

Debug prints debug log messages

func Error added in v0.6.0

func Error(err error, msg string, values ...any)

Error prints error log messages

func Fatal added in v0.6.0

func Fatal(err error, msg string, values ...any)

Fatal prints fatal log messages, which includes an exit call. There is no check here for if external tests are being run, so that callers can still see fatal log messages.

func Info added in v0.6.0

func Info(msg string, values ...any)

Info prints info log messages

func SetLoggerPrefixName

func SetLoggerPrefixName(name string)

SetLoggerPrefixName is used to construct the custom part of the log prefix of the loggers. It is called as part of the init() call in this package and given a default value, but callers can override this value with a different string value, typically the calling application's name (e.g. "rhad")

func Warn added in v0.6.0

func Warn(msg string, values ...any)

Warn prints warning log messages

Types

This section is empty.

Jump to

Keyboard shortcuts

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