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 disabled; if greater than or equal to the LevelFilter
, that
level is enabled.
Note that this is essentially identical to the Level
type, but with the
addition of an OFF
level that completely disables all trace
instrumentation.
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.
sourcepub fn as_log(&self) -> <LevelFilter as AsLog>::Log
pub fn as_log(&self) -> <LevelFilter as AsLog>::Log
Returns the log
equivalent of self
.
sourceimpl Clone for LevelFilter
impl Clone for LevelFilter
sourcepub fn clone(&self) -> LevelFilter
pub 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
sourcepub fn from(level: Level) -> LevelFilter
pub fn from(level: Level) -> LevelFilter
Performs the conversion.
sourceimpl From<LevelFilter> for Directive
impl From<LevelFilter> for Directive
sourcefn from(level: LevelFilter) -> Self
fn from(level: LevelFilter) -> Self
Performs the conversion.
sourceimpl From<Option<Level>> for LevelFilter
impl From<Option<Level>> for LevelFilter
sourcepub fn from(level: Option<Level>) -> LevelFilter
pub 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.
sourcepub fn from_str(
from: &str
) -> Result<LevelFilter, <LevelFilter as FromStr>::Err>
pub 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<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
sourcepub fn eq(&self, other: &LevelFilter) -> bool
pub fn eq(&self, other: &LevelFilter) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcepub fn ne(&self, other: &LevelFilter) -> bool
pub fn ne(&self, other: &LevelFilter) -> bool
This method tests for !=
.
sourceimpl PartialOrd<Level> for LevelFilter
impl PartialOrd<Level> for LevelFilter
sourcepub fn partial_cmp(&self, other: &Level) -> Option<Ordering>
pub fn partial_cmp(&self, other: &Level) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcepub fn lt(&self, other: &Level) -> bool
pub fn lt(&self, other: &Level) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcepub fn le(&self, other: &Level) -> bool
pub 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
sourcepub fn partial_cmp(&self, other: &LevelFilter) -> Option<Ordering>
pub fn partial_cmp(&self, other: &LevelFilter) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcepub fn lt(&self, other: &LevelFilter) -> bool
pub fn lt(&self, other: &LevelFilter) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcepub fn le(&self, other: &LevelFilter) -> bool
pub 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
sourcepub fn gt(&self, other: &LevelFilter) -> bool
pub fn gt(&self, other: &LevelFilter) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
sourcepub fn ge(&self, other: &LevelFilter) -> bool
pub 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 · sourcepub fn borrow_mut(&mut self) -> &mut T
pub 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>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more