logging

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

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

View Source
const (
	FormatText = "text" // default; human-readable
	FormatJSON = "json" // structured, for log aggregation backends
)

Format identifiers for the log handler.

View Source
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

func FromConfig(w io.Writer, format, level string) *slog.Logger

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

func New(w io.Writer, format, level string) *slog.Logger

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

func ParseLevel(s string) slog.Level

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.

Jump to

Keyboard shortcuts

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