Documentation
¶
Overview ¶
Package logging builds RunLore's slog logger with a configurable output format (human-readable text or structured JSON) and verbosity level. In-cluster deployments choose JSON so logs are ingestible by Loki/VictoriaLogs/CloudWatch; local CLI runs keep text. Format and level come from config, with the RUNLORE_LOG_FORMAT / RUNLORE_LOG_LEVEL env vars overriding (so verbosity is tunable without editing config — useful for a quick debug session).
Index ¶
Constants ¶
const ( FormatText = "text" // default; human-readable FormatJSON = "json" // structured, for log aggregation backends )
Format identifiers for the log handler.
const ( EnvFormat = "RUNLORE_LOG_FORMAT" EnvLevel = "RUNLORE_LOG_LEVEL" )
Env vars that override the configured format/level at startup.
Variables ¶
This section is empty.
Functions ¶
func FromConfig ¶
FromConfig builds a logger from the configured format/level, with the RUNLORE_LOG_FORMAT / RUNLORE_LOG_LEVEL env vars taking precedence when set.
func New ¶
New returns a slog.Logger writing to w with the given format and level. An unrecognized format falls back to text; an unrecognized/empty level to info.
func ParseLevel ¶
ParseLevel maps a level name (case-insensitive) to a slog.Level. Unknown or empty values map to Info — the safe production default.
Types ¶
This section is empty.