Documentation
¶
Overview ¶
Package logging builds the application's structured logger (log/slog) and carries a per-request correlation id through context.
Wiring model: the process installs one configured logger as slog.Default via Setup, so every subsystem that already logs through slog — river, watermill (via NewSlogLogger), and the HTTP handlers — shares the same level, format, and sink without threading a *slog.Logger through every constructor. Request scoping is done via context (FromContext), not by injecting a logger.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext returns the default logger, tagged with the request id when the context carries one. Use this at request-scoped log sites so every line correlates back to the originating HTTP request.
func New ¶
New builds a logger from config: a coloured, human-readable handler for LogFormat "text" (dev), otherwise structured JSON (prod). Level is one of debug|info|warn|error, defaulting to info for anything unrecognised.
func RequestIDFromContext ¶
RequestIDFromContext returns the request id carried by ctx, if any.
Types ¶
This section is empty.