Expand description
File logging (spec “Logging”): <home>/logs/serve-<pid>.log and pair-<pair-id>.log, level
info (debug on request), a 5 MiB cap that rolls once to .1, and retention. Nothing here
ever writes to stdout: stdout is the MCP channel.
Structs§
- Capped
Writer - An append-only file that moves itself to
<name>.1(replacing any earlier one) before a write that would take it past the cap. Whole writes stay whole; there is never a.2. - Group 🔒
- LogHandle
- Keeps the log alive: dropping it flushes the worker and (Scoped) uninstalls the subscriber.
Enums§
Constants§
- KEEP_
NEWEST - Retention: files beyond the newest 20 of their kind …
- LOG_
CAP_ BYTES - The size at which a log file rolls to
.1. - RETAIN_
MAX_ AGE_ MS - … AND older than this.
Functions§
- classify 🔒
serve-<pid>.log[.1]/pair-<12 hex>.log[.1]-> (kind, id, is_rolled).- create_
logs_ 🔒dir - init_
file_ logging - Open
pathas a non-blocking, ANSI-free file log.Globalinstalls the process subscriber withtry_init(a second call returns a handle and leaves the first subscriber in place);Scopedinstalls a thread-local default whose guard lives in the handle. - mtime_
ms 🔒 - open_
append 🔒 - retain
- Log retention (spec Logging). A base log and its
.1form one group of their kind (serve-*andpair-*are counted separately); a group is deleted only when it is beyond the newest 20 of its kind AND its newest file is older than 14 days AND its owner is gone: forserve-<pid>the pid is dead, forpair-<id>pair_is_dead(id). Decisions key on the FILE NAME’s id. Returns the files removed. - rolled_
name 🔒