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 = LevelFilter(None)
pub const OFF: LevelFilter = LevelFilter(None)
The “off” level.
Designates that trace instrumentation should be completely disabled.
sourcepub const ERROR: LevelFilter = LevelFilter::from_level(Level::ERROR)
pub const ERROR: LevelFilter = LevelFilter::from_level(Level::ERROR)
The “error” level.
Designates very serious errors.
sourcepub const WARN: LevelFilter = LevelFilter::from_level(Level::WARN)
pub const WARN: LevelFilter = LevelFilter::from_level(Level::WARN)
The “warn” level.
Designates hazardous situations.
sourcepub const INFO: LevelFilter = LevelFilter::from_level(Level::INFO)
pub const INFO: LevelFilter = LevelFilter::from_level(Level::INFO)
The “info” level.
Designates useful information.
sourcepub const DEBUG: LevelFilter = LevelFilter::from_level(Level::DEBUG)
pub const DEBUG: LevelFilter = LevelFilter::from_level(Level::DEBUG)
The “debug” level.
Designates lower priority information.
sourcepub const TRACE: LevelFilter = LevelFilter(Some(Level::TRACE))
pub const TRACE: LevelFilter = LevelFilter(Some(Level::TRACE))
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 From<Level> for LevelFilter
impl From<Level> for LevelFilter
sourcefn from(level: Level) -> LevelFilter
fn from(level: Level) -> LevelFilter
Converts to this type from the input type.
sourceimpl From<LevelFilter> for Directive
impl From<LevelFilter> for Directive
sourcefn from(level: LevelFilter) -> Self
fn from(level: LevelFilter) -> Self
Converts to this type from the input type.
sourceimpl From<Option<Level>> for LevelFilter
impl From<Option<Level>> for LevelFilter
sourcefn from(level: Option<Level>) -> LevelFilter
fn from(level: Option<Level>) -> LevelFilter
Converts to this type from the input type.
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 new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)
fn 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
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> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more