pub struct Config {
pub module_id: String,
pub logs_dir: PathBuf,
pub bound: Vec<(String, String)>,
pub spec: Option<String>,
pub retention: SegmentRetention,
pub redactor: Option<Arc<Redactor>>,
pub clock: Option<Arc<dyn Fn() -> SystemTime + Send + Sync>>,
}Expand description
Logger configuration for one process.
Fields§
§module_id: StringStable fleet module identifier: the root of every logger name and the first part of every segment’s file name.
logs_dir: PathBufThe directory the segments live in. Fleet callers never assemble this:
Config::for_module derives it from the module id through the same
resolver every store uses, so a log cannot land beside the wrong data.
Public for tests and for the daemon’s own run/logs/ lane, which is not
a module data directory.
bound: Vec<(String, String)>Fields bound for the whole process and rendered in the bracket on every
line, in this order. A harness-hosted plugin binds harness=<name>
here: after r2 every lane shares one segment and this is what tells
them apart.
spec: Option<String>CK_LOG override; None reads the process environment.
retention: SegmentRetentionAge window and oversize alarm for the segments.
redactor: Option<Arc<Redactor>>Optional module redactor, applied after fleet credential redaction.
clock: Option<Arc<dyn Fn() -> SystemTime + Send + Sync>>Optional clock override for deterministic callers and tests.
Implementations§
Source§impl Config
impl Config
Sourcepub fn in_dir(module_id: &str, logs_dir: impl Into<PathBuf>) -> Self
pub fn in_dir(module_id: &str, logs_dir: impl Into<PathBuf>) -> Self
A configuration whose segment directory the caller already resolved:
CK_LOG from the environment, fleet default retention, nothing bound.
This is the path for a consumer that owns its module data directory
through its own pinned store crate and must not pull a second copy of
it through this one (see the store-paths feature).
Sourcepub fn for_module(module_id: &str) -> Self
pub fn for_module(module_id: &str) -> Self
The fleet configuration for a supervised module’s own process: segments
under <module data dir>/logs/, CK_LOG from the environment (the
daemon injects it at spawn), fleet default retention, nothing bound.
Sourcepub fn for_plugin(module_id: &str, harness: &str) -> Self
pub fn for_plugin(module_id: &str, harness: &str) -> Self
Config::for_module with harness=<harness> bound on every line, for
a plugin running inside a harness process.
Sourcepub fn from_env() -> Result<Self, InitError>
pub fn from_env() -> Result<Self, InitError>
The configuration a supervised module can build with no arguments,
because the daemon already injects everything it needs at spawn:
SUBC_MODULE_ID (for launch attestation), CK_LOG, and the retention
knobs as CK_LOG_MAX_AGE_DAYS / CK_LOG_ALARM_SEGMENT_MB. This is the
zero-argument path the r2 spec requires so that reaching for the crate
costs no more than reaching for eprintln!.