Expand description
A synchronous tracing layer for CortexKit’s module-owned fleet logs.
One crate, one format, one file per module per day. See
subconscious/docs/specs/fleet-logging.md (r2) for the contract every line
here implements; the golden fixture beside it is what the tests pin to.
Structs§
- Config
- Logger configuration for one process.
- Handle
- A live logger handle suitable for inclusion in module health reports.
- Line
Sink - A rotating file sink for bytes the caller has already framed as complete lines — captured child output, forwarded worker rings, anything that is already a log line and must not be re-formatted.
- LogLayer
- The fleet
tracinglayer, built bylayerorlayer_with_stderr_copyfor a caller that installs its own subscriber. - Parse
Error - A stable parse failure returned by
parse_line. - Parsed
Line - The fields needed to merge and filter a fleet log line.
- Retention
- Size and age bounds for the rename-rotated
LineSink, which has exactly one writer (the daemon’s per-child stderr capture). The logger’s own segments useSegmentRetention; the two are different files with different writer counts, and only the single-writer one may rename. - Segment
Retention - Retention for date segments: an age window pruned by the writer, and a per-segment size at which the writer raises an alarm rather than rotating.
Enums§
- Init
Error - An error that prevents installation of the global logger.
- Parsed
Level - A level parsed from a fleet log line.
Functions§
- init
- Installs the fleet logger as the process-global
tracingsubscriber. - init_
from_ env initwithConfig::from_env: the whole setup for a supervised module.- installed
- The logger this process installed with
init, if it installed one. - layer
- The fleet layer without installing anything global, for a caller that
composes its own
tracingsubscriber stack. Unlikeinit, it installs no global subscriber and no panic hook (Handle::install_panic_hookdoes that), andinstalleddoes not return its handle. - layer_
with_ stderr_ copy layerthat also writes every rendered line to stderr after it reaches the segment. For a process whose stderr is watched by a person or a parent (a standalone bridge, a CLI), where the segment alone would hide its output. A supervised module should not use it: the daemon captures a module’s stderr separately, so every line would be stored twice. When the segment directory cannot be opened, lines already go to stderr and are not doubled.- parse_
line - Parses the fixed columns used by merged and filtered fleet log views.
- prune_
candidates - Segments older than the window, decided by filename alone. Names that are not this module’s segments are never returned.
- segment_
day - Parses
<module_id>.<YYYY-MM-DD>.logback into its day, orNonefor any name that is not exactly that shape — including the r1 pid-suffixed files and a malformed date, which are left alone rather than guessed at. - segment_
name - The filename for
module_id’s segment on the UTC day containingat. - session_
span - Creates a span carrying canonical session lineage for nested events. Every
event inside it renders
session=<issuer>:<id>in the bound bracket.
Type Aliases§
- Redactor
- A complete-line redactor composed after the fleet credential redactor.