pub struct LevelPredicate { /* private fields */ }Expand description
Default predicate: enables everything at or below the current
LevelFilter setting (including OFF for “disable everything”).
The level is dynamic — call LevelPredicate::handle to grab a
cheap-to-clone LevelHandle that can change it from another
thread/task at runtime without rebuilding the subscriber. Every
callsite_enabled returns Sometimes so tracing-core re-asks
enabled on each event/span, picking up live changes immediately;
LevelHandle::set additionally calls
tracing::callsite::rebuild_interest_cache so any callsites that
were registered before the level changed get re-evaluated against
the new max_level_hint.
Implementations§
Source§impl LevelPredicate
impl LevelPredicate
Sourcepub fn new(level: Level) -> Self
pub fn new(level: Level) -> Self
Construct from a tracing::Level (legacy callers). See
with_filter for the LevelFilter form
that can also express OFF.
Sourcepub fn with_filter(filter: LevelFilter) -> Self
pub fn with_filter(filter: LevelFilter) -> Self
Construct from a LevelFilter (the only way to start OFF).
Sourcepub fn handle(&self) -> LevelHandle
pub fn handle(&self) -> LevelHandle
A cheap-to-clone handle that sets/gets the current level from other threads/tasks — typically held by an admin RPC.