Documentation ¶
Overview ¶
Package log provides module-level logging capabilities for interacting with go standard-library's log/slog package.
Package log provides a logging framework with level support and pluggable export destinations.
Index ¶
Constants ¶
const ( Trace = slog.Level(-8) Debug = slog.LevelDebug Info = slog.LevelInfo Notice = slog.Level(2) Warning = slog.LevelWarn Error = slog.LevelError Emergency = slog.Level(12) )
Exported constants representing slog.Level.
- Trace for tracing program's execution.
- Debug for providing contextual information in debugging phase.
- Info for informing about general system operations.
- Notice for conditions that are not errors but might need handling.
- Warning for warning conditions.
- Error for error conditions.
- Emergency for system-unusable conditions.
Variables ¶
This section is empty.
Functions ¶
func Default ¶
func Default(level string)
Default sets the default log level to the specified level, and will instantiate a global default logger.
- See Global for additional details.
func Global ¶
func Global()
Global sets up the global slog configuration according to LOG_LEVEL environment variable. It manages log levels and creates a handler with options for log level, customization of attributes and output to stdout as JSON. Here is the list of log levels with their priorities:
TRACE < DEBUG < INFO < NOTICE < WARNING < ERROR < EMERGENCY
The default log level is INFO.
Types ¶
This section is empty.