logging

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package logging sets up structured slog logging and provides PairTag, the one function every log call site touching a pair_id MUST go through. spec/PROTOCOL.md §3 requires logs never carry the raw pair_id (it's a bearer capability); PairTag is what makes "never" enforceable by convention rather than by remembering to hash it correctly every time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

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

New builds the process-wide logger per cfg.LogLevel/LogFormat.

func PairTag

func PairTag(pairID [16]byte) string

PairTag returns the correlation id logged in place of a raw pair_id: the first 4 bytes of SHA-256(pair_id), hex-encoded. Short enough to skim in logs, long enough (32 bits) that distinct pairs essentially never collide in a single deploy's log stream, and — the actual point — computationally infeasible to invert back to the pair_id, which is a bearer capability for reaching someone's desktop agent.

func TokenTag

func TokenTag(tokenHash [32]byte) string

TokenTag is PairTag's equivalent for an API key's hash (spec §11): the correlation id logged in place of the full token_hash.

The hash cannot be inverted to a usable key, so this is not the same secrecy requirement PairTag carries — it exists so log lines stay skimmable and so no single field is long enough to tempt anyone into treating it as an identifier to pass around. The raw API KEY, which is a bearer capability, must never reach a log line in any form: it arrives in a request path or an Authorization header, and both are stripped before logging (see the Caddyfile's uri filter).

Types

This section is empty.

Jump to

Keyboard shortcuts

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