You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(observability): add structured slog logging to eviction/expiration loops and cluster lifecycle
Introduce a `WithLogger[T](*slog.Logger)` option on `HyperCache` that wires a
structured `slog.Logger` through the wrapper's background loops and lifecycle
surfaces. Previously the eviction loop, expiration loop, and cluster-join
startup ran fully silent, requiring operators to infer activity from counters.
Changes:
- `eviction loop starting/stopped` logged with interval, max_per_tick, and
algorithm; per-tick `eviction tick` at Info when items evicted, Debug when
idle; `eviction triggered` on manual `TriggerEviction` calls with coalesced
triggers at Debug.
- `expiration loop starting/stopped`; per-tick `expiration tick` with the same
Info/Debug shape.
- `peer added/removed to membership` records in DistMemory so dynamic cluster
joins are visible to log-based observers.
- `hypercache-server` binary wired via `WithLogger` so new records surface in
the binary's JSON output alongside existing dist-transport logs.
Defaults to `slog.DiscardHandler` so library-mode embedded uses stay silent.
Passing nil resets to the discard handler. Tests in
`hypercache_logging_test.go` assert the eviction/expiration startup contract
on a real cache instance with a JSON-captured logger;
`tests/integration/dist_logging_test.go` covers cluster-join + AddPeer records
against a real DistMemory node.
0 commit comments