Skip to main content

Crate cortexkit_log

Crate cortexkit_log 

Source
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
Logger names for dependency crates and maximum levels for crates and modules.
Handle
A live logger handle suitable for inclusion in module health reports.
LevelFilter
A filter comparable to a verbosity Level.
LineSink
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 tracing layer, built by layer or layer_with_stderr_copy for a caller that installs its own subscriber.
ParseError
A stable parse failure returned by parse_line.
ParsedLine
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 use SegmentRetention; the two are different files with different writer counts, and only the single-writer one may rename.
SegmentRetention
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§

InitError
An error that prevents installation of the global logger.
ParsedLevel
A level parsed from a fleet log line.

Functions§

init
Installs the fleet logger as the process-global tracing subscriber.
init_from_env
init with Config::from_env: the whole setup for a supervised module.
init_from_env_with_crates
init_from_env with 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 tracing subscriber stack. Unlike init, it installs no global subscriber and no panic hook (Handle::install_panic_hook does that), and installed does not return its handle.
layer_with_stderr_copy
layer that 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>.log back into its day, or None for 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 containing at.
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.