Documentation
¶
Overview ¶
Package log is the structured-logging entry point for Gantry.
The design docs mandate WARN-level emission in specific places (forced cache eviction in the design doc, HRW rank mismatch in the design doc). This package wraps log/slog with a consistent attribute vocabulary so those WARN lines are uniformly tagged and machine-parseable.
Standard attributes (use the helper constructors below to set them so keys don't drift):
subsystem one of {"mirror","transfer","cache","origin","coord",
"discovery","hrw","members","cdsub","agent"}
digest OCI digest string ("sha256:...")
peer NodeID of a remote peer
registry upstream registry name
repo OCI repository
class the design doc failure class
Level conventions:
DEBUG per-RPC traces, per-byte transfer milestones INFO state transitions, lifecycle events WARN the design doc forced eviction, the design doc HRW rank mismatch, soft failures that the design explicitly calls out ERROR hard failures requiring operator attention
Index ¶
- func Class(c string) slog.Attr
- func Context(_ context.Context, parent *slog.Logger, attrs ...slog.Attr) *slog.Logger
- func Digest(d fmt.Stringer) slog.Attr
- func Err(err error) slog.Attr
- func New(w io.Writer, level, format string) *slog.Logger
- func NodeID(id fmt.Stringer) slog.Attr
- func Peer(p fmt.Stringer) slog.Attr
- func Registry(name string) slog.Attr
- func Repo(name string) slog.Attr
- func Subsystem(base *slog.Logger, name string) *slog.Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Class ¶
Class builds a slog.Attr carrying the standard "class" key (the design doc failure class).
func Context ¶
Context is a tiny helper for the case where a function wants to bind per-request attributes onto a child logger and pass it down - e.g., a mirror request handler binding (registry, repo, digest) once at the top.
func New ¶
New returns a *slog.Logger configured for the given level and format. format is "json" or "text"; anything else is treated as "json" with a warning logged at startup by the caller.
Types ¶
This section is empty.