Expand description
A synchronous tracing layer for CortexKit’s module-owned fleet logs.
One crate, one format, one file per module per day. Every line follows the stable fleet logging format pinned by the crate’s golden fixtures.
A Crates policy labels dependency events <module_id>.dep.<crate>, with
underscores in Rust crate names written as hyphens. Dependencies default to
WARN or the module’s own level, whichever is lower; a matching CK_LOG
directive can raise that level. Per-crate ceilings always win, including an
OFF ceiling for dependencies whose verbose output may expose credentials or
connection details. An outer filter_fn cannot bypass the layer’s
per-event level and ceiling checks, although its own predicate can suppress
events; it is unnecessary for enforcing CK_LOG.
Structs§
- Config
- Logger configuration for one process.
- Crates
- Dependency crates whose log names and maximum levels are controlled by this logger.
- Handle
- A live logger handle suitable for inclusion in module health reports.
- Level
Filter - A filter comparable to a verbosity
Level. - 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.- init_
from_ env_ with_ crates init_from_envwith dependency crate labels and level controls.- init_
with_ crates - Installs the fleet logger with dependency crate labels and level controls.
- 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.