Documentation
¶
Overview ¶
Package log provides a lightweight thread-safe logging facility using structured logging (slog) with JSON output format. It offers a singleton logger instance with configurable log levels through environment variables and convenience methods for fatal error logging.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FatalF ¶
FatalF logs a formatted message at Fatal level and then calls os.Exit(1). It follows the printf formatting rules.
func FatalLn ¶
func FatalLn(args ...any)
FatalLn logs a message at Fatal level with a line feed and then calls os.Exit(1).
func Level ¶
Level returns the logging level for the SPIKE components.
It reads from the SPIKE_SYSTEM_LOG_LEVEL environment variable and converts it to the corresponding slog.Level value. Valid values (case-insensitive) are:
- "DEBUG": returns slog.LevelDebug
- "INFO": returns slog.LevelInfo
- "WARN": returns slog.LevelWarn
- "ERROR": returns slog.LevelError
If the environment variable is not set or contains an invalid value, it returns the default level slog.LevelWarn.
Types ¶
This section is empty.