Documentation
¶
Overview ¶
Package logger initialises the application-wide slog.Logger. 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 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.