Documentation
¶
Overview ¶
Package logger initialises the application-wide slog.Logger and the LAL-internal nazalog level so a single config knob covers both. One logger is created at startup and passed via DI. Never call slog.SetDefault in tests — use the injected logger instead.
Index ¶
Constants ¶
const LevelTrace = slog.Level(-8)
LevelTrace is a custom slog level below Debug for very high-frequency logs (per-segment flushes, per-RTP packet, etc.) that would otherwise drown out useful Debug output. Set log.level to "trace" to enable.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶ added in v0.0.97
Apply installs cfg as the current process-wide logging configuration: it sets slog.SetDefault to a logger built from cfg AND re-initialises LAL's nazalog level via lalLevel(cfg). Calling this on every config change (startup + runtime hot-reload) keeps both logging stacks in lock-step — without the nazalog half, hot-reloading log.level via the /config API only affects slog and lal continues emitting whatever level was set at boot, which is the most common "I lowered my log level but lal's INFO chatter still floods journalctl" footgun.
func New ¶
New creates a slog.Logger from the given LogConfig. Format "json" produces structured JSON; anything else produces human-readable text.
Recognised levels: trace (most verbose), debug, info (default), warn, error. The "trace" level enables per-segment / per-packet logs that debug deliberately omits.
func NewWithWriter ¶
NewWithWriter creates a logger that writes to the provided writer (useful for tests).
func Trace ¶ added in v0.0.77
Trace emits a log record at LevelTrace via the default logger. Use this for hot-path events (e.g. HLS / DASH / DVR segment flushed) so they only show when the operator opts in via log.level=trace.
Background context is intentional: Trace is fire-and-forget, used in hot paths where threading a real context would force every caller (and every caller's caller) to grow a ctx parameter just for a debug print.
Types ¶
This section is empty.