logger

package
v0.0.78 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 5 Imported by: 0

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

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

func New(cfg config.LogConfig) *slog.Logger

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

func NewWithWriter(w io.Writer, level slog.Level) *slog.Logger

NewWithWriter creates a logger that writes to the provided writer (useful for tests).

func Trace added in v0.0.77

func Trace(msg string, args ...any)

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.

Jump to

Keyboard shortcuts

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