Documentation ¶
Overview ¶
Package logging implements support for structured logging.
This package is inspired heavily by go-logging, kit/log and the CometBFT libs/log packages, and is oriented towards making the structured logging experience somewhat easier to use.
Index ¶
Constants ¶
const LogEvent = "log_event"
LogEvent is the structured log key used to signal log events to be easily parsed by the testing harness.
Values should be defined as constants in the respective modules that emit these events.
Variables ¶
This section is empty.
Functions ¶
func Initialize ¶
Initialize initializes the logging backend to write to the provided Writer with the given format and log levels specified for each module. If the requested module is not given, default level is taken. If the Writer is nil, all log output will be silently discarded.
Types ¶
type Format ¶
type Format uint
Format is a logging format.
type Level ¶
type Level uint
Level is a log level.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a logger instance.
func GetBaseLogger ¶ added in v0.2201.7
GetBaseLogger creates a new non-prefixed logger instance with the specified module.
The returned logger will not pre-include any log fields (aka prefixes) except for the module name. Its level will be set in accordance with the global config, which can be per-module.
This may be called from any point, including before Initialize is called, allowing for the construction of a package level Logger.
func GetLogger ¶
GetLogger creates a new logger instance with the specified module.
This may be called from any point, including before Initialize is called, allowing for the construction of a package level Logger.
func GetLoggerEx ¶
GetLoggerEx creates a new logger instance with the specified module, using the specified extra levels of stack unwinding when determining a caller.
The GetLogger call is equivalent to GetLoggerEx with an extraUnwind of 0. This routine is primarily intended to facilitate writing additional logging wrappers.
func NewNopLogger ¶ added in v0.2400.0
func NewNopLogger() *Logger
NewNopLogger creates a logger that doesn't perform any logging.