[−][src]Struct tracing_subscriber::filter::EnvFilter
A Layer
which filters spans and events based on a set of filter
directives.
Methods
impl EnvFilter
[src]
pub const DEFAULT_ENV: &'static str
[src]
The default environment variable used by EnvFilter::from_default_env
and EnvFilter::try_from_default_env
.
pub fn from_default_env() -> Self
[src]
Returns a new EnvFilter
from the value of the RUST_LOG
environment
variable, ignoring any invalid filter directives.
pub fn from_env<A: AsRef<str>>(env: A) -> Self
[src]
Returns a new EnvFilter
from the value of the given environment
variable, ignoring any invalid filter directives.
pub fn new<S: AsRef<str>>(dirs: S) -> Self
[src]
Returns a new EnvFilter
from the directives in the given string,
ignoring any that are invalid.
pub fn try_new<S: AsRef<str>>(dirs: S) -> Result<Self, ParseError>
[src]
Returns a new EnvFilter
from the directives in the given string,
or an error if any are invalid.
pub fn try_from_default_env() -> Result<Self, FromEnvError>
[src]
Returns a new EnvFilter
from the value of the RUST_LOG
environment
variable, or an error if the environment variable contains any invalid
filter directives.
pub fn try_from_env<A: AsRef<str>>(env: A) -> Result<Self, FromEnvError>
[src]
Returns a new EnvFilter
from the value of the given environment
variable, or an error if the environment variable is unset or contains
any invalid filter directives.
pub fn add_directive(self, directive: Directive) -> Self
[src]
Add a filtering directive to this EnvFilter
.
The added directive will be used in addition to any previously set directives, either added using this method or provided when the filter is constructed.
Filters may be created from may be LevelFilter
s, which will
enable all traces at or below a certain verbosity level, or
parsed from a string specifying a directive.
If a filter directive is inserted that matches exactly the same spans and events as a previous filter, but sets a different level for those spans and events, the previous directive is overwritten.
Examples
use tracing_subscriber::filter::{EnvFilter, LevelFilter}; let mut filter = EnvFilter::from_default_env() .add_directive(LevelFilter::INFO.into());
use tracing_subscriber::filter::{EnvFilter, Directive}; let mut filter = EnvFilter::try_from_default_env()? .add_directive("my_crate::module=trace".parse()?) .add_directive("my_crate::my_other_module::something=info".parse()?);
Trait Implementations
impl<S: Subscriber> Layer<S> for EnvFilter
[src]
fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest
[src]
fn enabled(&self, metadata: &Metadata, _: Context<S>) -> bool
[src]
fn new_span(&self, attrs: &Attributes, id: &Id, _: Context<S>)
[src]
fn on_record(&self, id: &Id, values: &Record, _: Context<S>)
[src]
fn on_enter(&self, id: &Id, _: Context<S>)
[src]
fn on_exit(&self, id: &Id, _: Context<S>)
[src]
fn on_close(&self, id: Id, _: Context<S>)
[src]
fn on_follows_from(&self, _span: &Id, _follows: &Id, _ctx: Context<S>)
[src]
fn on_event(&self, _event: &Event, _ctx: Context<S>)
[src]
fn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<S>)
[src]
fn and_then<L>(self, layer: L) -> Layered<L, Self, S> where
L: Layer<S>,
Self: Sized,
[src]
L: Layer<S>,
Self: Sized,
fn with_subscriber(self, inner: S) -> Layered<Self, S> where
Self: Sized,
[src]
Self: Sized,
impl Default for EnvFilter
[src]
impl<S> From<S> for EnvFilter where
S: AsRef<str>,
[src]
S: AsRef<str>,
impl Debug for EnvFilter
[src]
impl Display for EnvFilter
[src]
impl FromStr for EnvFilter
[src]
Auto Trait Implementations
impl Send for EnvFilter
impl Unpin for EnvFilter
impl Sync for EnvFilter
impl UnwindSafe for EnvFilter
impl RefUnwindSafe for EnvFilter
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,