#[non_exhaustive]pub struct Crates { /* private fields */ }Expand description
Logger names for dependency crates and maximum levels for crates and modules.
Crates::own takes crate names in Rust spelling, for example
my_module_core; events from those crates retain the logger-name behavior used
without a crate policy. Other crates are labelled <module_id>.dep.<crate>, with
underscores changed to hyphens. Unless a CK_LOG directive names a
dependency, its level is capped at WARN or the module’s own resolved level,
whichever is lower. Ceilings are enforced after all CK_LOG directives and
rechecked while writing, so an outer filter_fn cannot bypass them, although
its own predicate can still suppress events.
Pair this with cortexkit-bus-client 0.1.17’s outage logs to drop redundant
reconnect and handshake logs while keeping async-nats’s other warnings and
errors:
use cortexkit_log::{Crates, LevelFilter};
let crates = Crates::new()
.ceiling("async_nats", LevelFilter::WARN)
.ceiling("async_nats::connector", LevelFilter::OFF);Implementations§
Source§impl Crates
impl Crates
Sourcepub fn own<I, S>(self, crate_names: I) -> Self
pub fn own<I, S>(self, crate_names: I) -> Self
Adds crate names that belong to this module rather than its dependencies.
Events from these crates keep the logger-name behavior used without a crate policy.
Sourcepub fn ceiling(
self,
crate_or_module: impl Into<String>,
level: LevelFilter,
) -> Self
pub fn ceiling( self, crate_or_module: impl Into<String>, level: LevelFilter, ) -> Self
Sets the maximum level for a dependency crate or a Rust module path.
Use Rust spelling, such as transport_layer or transport_layer::retry.
The event’s module path (or target if absent) matches on :: boundaries.
The most specific ceiling wins, regardless of insertion order. Module
path ceilings also apply to Self::own crates, which ignore bare crate
ceilings. Neither type of ceiling changes the logger name.
The ceiling applies after CK_LOG; no directive can raise the event’s
level above it. An OFF ceiling drops matching events. Ceilings can keep
verbose transport output containing credentials out of the logs.