Struct tracing_subscriber::filter::LevelFilter
source · [−]#[repr(transparent)]pub struct LevelFilter(_);
Expand description
A filter comparable to a verbosity Level
.
If a Level
is considered less than a LevelFilter
, it should be
considered enabled; if greater than or equal to the LevelFilter
,
that level is disabled. See LevelFilter::current
for more
details.
Note that this is essentially identical to the Level
type, but with the
addition of an OFF
level that completely disables all trace
instrumentation.
See the documentation for the Level
type to see how Level
s
and LevelFilter
s interact.
Implementations
sourceimpl LevelFilter
impl LevelFilter
sourcepub const OFF: LevelFilter
pub const OFF: LevelFilter
The “off” level.
Designates that trace instrumentation should be completely disabled.
sourcepub const ERROR: LevelFilter
pub const ERROR: LevelFilter
The “error” level.
Designates very serious errors.
sourcepub const WARN: LevelFilter
pub const WARN: LevelFilter
The “warn” level.
Designates hazardous situations.
sourcepub const INFO: LevelFilter
pub const INFO: LevelFilter
The “info” level.
Designates useful information.
sourcepub const DEBUG: LevelFilter
pub const DEBUG: LevelFilter
The “debug” level.
Designates lower priority information.
sourcepub const TRACE: LevelFilter
pub const TRACE: LevelFilter
The “trace” level.
Designates very low priority, often extremely verbose, information.
sourcepub const fn from_level(level: Level) -> LevelFilter
pub const fn from_level(level: Level) -> LevelFilter
Returns a LevelFilter
that enables spans and events with verbosity up
to and including level
.
sourcepub const fn into_level(self) -> Option<Level>
pub const fn into_level(self) -> Option<Level>
sourcepub fn current() -> LevelFilter
pub fn current() -> LevelFilter
Returns a LevelFilter
that matches the most verbose Level
that any
currently active Subscriber
will enable.
User code should treat this as a hint. If a given span or event has a
level higher than the returned LevelFilter
, it will not be enabled.
However, if the level is less than or equal to this value, the span or
event is not guaranteed to be enabled; the subscriber will still
filter each callsite individually.
Therefore, comparing a given span or event’s level to the returned
LevelFilter
can be used for determining if something is
disabled, but should not be used for determining if something is
enabled.
Trait Implementations
sourceimpl AsLog for LevelFilter
impl AsLog for LevelFilter
type Log = LevelFilter
type Log = LevelFilter
The log
type that this type can be converted into.
sourcefn as_log(&self) -> <LevelFilter as AsLog>::Log
fn as_log(&self) -> <LevelFilter as AsLog>::Log
Returns the log
equivalent of self
.
sourceimpl Clone for LevelFilter
impl Clone for LevelFilter
sourcefn clone(&self) -> LevelFilter
fn clone(&self) -> LevelFilter
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for LevelFilter
impl Debug for LevelFilter
sourceimpl Display for LevelFilter
impl Display for LevelFilter
sourceimpl<S> Filter<S> for LevelFilter
impl<S> Filter<S> for LevelFilter
sourcefn enabled(&self, meta: &Metadata<'_>, _: &Context<'_, S>) -> bool
fn enabled(&self, meta: &Metadata<'_>, _: &Context<'_, S>) -> bool
Returns true
if this layer is interested in a span or event with the
given Metadata
in the current Context
, similarly to
Subscriber::enabled
. Read more
sourcefn callsite_enabled(&self, meta: &'static Metadata<'static>) -> Interest
fn callsite_enabled(&self, meta: &'static Metadata<'static>) -> Interest
sourcefn max_level_hint(&self) -> Option<LevelFilter>
fn max_level_hint(&self) -> Option<LevelFilter>
Returns an optional hint of the highest verbosity level that
this Filter
will enable. Read more
sourcefn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)
fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)
Notifies this filter that a new span was constructed with the given
Attributes
and Id
. Read more
sourcefn on_record(&self, id: &Id, values: &Record<'_>, ctx: Context<'_, S>)
fn on_record(&self, id: &Id, values: &Record<'_>, ctx: Context<'_, S>)
Notifies this filter that a span with the given Id
recorded the given
values
. Read more
sourcefn on_enter(&self, id: &Id, ctx: Context<'_, S>)
fn on_enter(&self, id: &Id, ctx: Context<'_, S>)
Notifies this filter that a span with the given ID was entered. Read more
sourceimpl From<Level> for LevelFilter
impl From<Level> for LevelFilter
sourcefn from(level: Level) -> LevelFilter
fn from(level: Level) -> LevelFilter
Performs the conversion.
sourceimpl From<Option<Level>> for LevelFilter
impl From<Option<Level>> for LevelFilter
sourcefn from(level: Option<Level>) -> LevelFilter
fn from(level: Option<Level>) -> LevelFilter
Performs the conversion.
sourceimpl FromStr for LevelFilter
impl FromStr for LevelFilter
type Err = ParseLevelFilterError
type Err = ParseLevelFilterError
The associated error which can be returned from parsing.
sourcefn from_str(from: &str) -> Result<LevelFilter, <LevelFilter as FromStr>::Err>
fn from_str(from: &str) -> Result<LevelFilter, <LevelFilter as FromStr>::Err>
Parses a string s
to return a value of this type. Read more
sourceimpl Hash for LevelFilter
impl Hash for LevelFilter
sourceimpl<S: Subscriber> Layer<S> for LevelFilter
impl<S: Subscriber> Layer<S> for LevelFilter
sourcefn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest
fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest
Registers a new callsite with this layer, returning whether or not
the layer is interested in being notified about the callsite, similarly
to Subscriber::register_callsite
. Read more
sourcefn enabled(&self, metadata: &Metadata<'_>, _: Context<'_, S>) -> bool
fn enabled(&self, metadata: &Metadata<'_>, _: Context<'_, S>) -> bool
Returns true
if this layer is interested in a span or event with the
given metadata
in the current Context
, similarly to
Subscriber::enabled
. Read more
sourcefn on_layer(&mut self, subscriber: &mut S)
fn on_layer(&mut self, subscriber: &mut S)
Performs late initialization when attaching a Layer
to a
Subscriber
. Read more
sourcefn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)
fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)
Notifies this layer that a new span was constructed with the given
Attributes
and Id
. Read more
sourcefn on_record(&self, _span: &Id, _values: &Record<'_>, _ctx: Context<'_, S>)
fn on_record(&self, _span: &Id, _values: &Record<'_>, _ctx: Context<'_, S>)
Notifies this layer that a span with the given Id
recorded the given
values
. Read more
sourcefn on_follows_from(&self, _span: &Id, _follows: &Id, _ctx: Context<'_, S>)
fn on_follows_from(&self, _span: &Id, _follows: &Id, _ctx: Context<'_, S>)
Notifies this layer that a span with the ID span
recorded that it
follows from the span with the ID follows
. Read more
sourcefn on_event(&self, _event: &Event<'_>, _ctx: Context<'_, S>)
fn on_event(&self, _event: &Event<'_>, _ctx: Context<'_, S>)
Notifies this layer that an event has occurred.
sourcefn on_enter(&self, _id: &Id, _ctx: Context<'_, S>)
fn on_enter(&self, _id: &Id, _ctx: Context<'_, S>)
Notifies this layer that a span with the given ID was entered.
sourcefn on_exit(&self, _id: &Id, _ctx: Context<'_, S>)
fn on_exit(&self, _id: &Id, _ctx: Context<'_, S>)
Notifies this layer that the span with the given ID was exited.
sourcefn on_close(&self, _id: Id, _ctx: Context<'_, S>)
fn on_close(&self, _id: Id, _ctx: Context<'_, S>)
Notifies this layer that the span with the given ID has been closed.
sourcefn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)
fn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)
Notifies this layer that a span ID has been cloned, and that the subscriber returned a different ID. Read more
sourcefn and_then<L>(self, layer: L) -> Layered<L, Self, S> where
L: Layer<S>,
Self: Sized,
fn and_then<L>(self, layer: L) -> Layered<L, Self, S> where
L: Layer<S>,
Self: Sized,
Composes this layer around the given Layer
, returning a Layered
struct implementing Layer
. Read more
sourcefn with_subscriber(self, inner: S) -> Layered<Self, S> where
Self: Sized,
fn with_subscriber(self, inner: S) -> Layered<Self, S> where
Self: Sized,
Composes this Layer
with the given Subscriber
, returning a
Layered
struct that implements Subscriber
. Read more
sourcefn with_filter<F>(self, filter: F) -> Filtered<Self, F, S> where
Self: Sized,
F: Filter<S>,
fn with_filter<F>(self, filter: F) -> Filtered<Self, F, S> where
Self: Sized,
F: Filter<S>,
sourceimpl Ord for LevelFilter
impl Ord for LevelFilter
sourceimpl PartialEq<Level> for LevelFilter
impl PartialEq<Level> for LevelFilter
sourceimpl PartialEq<LevelFilter> for LevelFilter
impl PartialEq<LevelFilter> for LevelFilter
sourcefn eq(&self, other: &LevelFilter) -> bool
fn eq(&self, other: &LevelFilter) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &LevelFilter) -> bool
fn ne(&self, other: &LevelFilter) -> bool
This method tests for !=
.
sourceimpl PartialOrd<Level> for LevelFilter
impl PartialOrd<Level> for LevelFilter
sourcefn partial_cmp(&self, other: &Level) -> Option<Ordering>
fn partial_cmp(&self, other: &Level) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, other: &Level) -> bool
fn lt(&self, other: &Level) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, other: &Level) -> bool
fn le(&self, other: &Level) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<LevelFilter> for LevelFilter
impl PartialOrd<LevelFilter> for LevelFilter
sourcefn partial_cmp(&self, other: &LevelFilter) -> Option<Ordering>
fn partial_cmp(&self, other: &LevelFilter) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, other: &LevelFilter) -> bool
fn lt(&self, other: &LevelFilter) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, other: &LevelFilter) -> bool
fn le(&self, other: &LevelFilter) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourcefn gt(&self, other: &LevelFilter) -> bool
fn gt(&self, other: &LevelFilter) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
sourcefn ge(&self, other: &LevelFilter) -> bool
fn ge(&self, other: &LevelFilter) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Copy for LevelFilter
impl Eq for LevelFilter
impl StructuralEq for LevelFilter
impl StructuralPartialEq for LevelFilter
Auto Trait Implementations
impl RefUnwindSafe for LevelFilter
impl Send for LevelFilter
impl Sync for LevelFilter
impl Unpin for LevelFilter
impl UnwindSafe for LevelFilter
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. Read more