Struct logforth::filter::env::EnvFilterBuilder
source · pub struct EnvFilterBuilder(/* private fields */);
Available on crate feature
env-filter
only.Expand description
A builder for the env log filter.
It can be used to parse a set of directives from a string before building a EnvFilter instance.
Implementations§
source§impl EnvFilterBuilder
impl EnvFilterBuilder
sourcepub fn try_from_env(env: &str) -> Option<Self>
pub fn try_from_env(env: &str) -> Option<Self>
Try to initialize the filter builder from an environment; return None
if the environment
variable is not set or invalid.
sourcepub fn filter_module(self, module: &str, level: LevelFilter) -> Self
pub fn filter_module(self, module: &str, level: LevelFilter) -> Self
Adds a directive to the filter for a specific module.
sourcepub fn filter_level(self, level: LevelFilter) -> Self
pub fn filter_level(self, level: LevelFilter) -> Self
Adds a directive to the filter for all modules.
sourcepub fn filter(self, module: Option<&str>, level: LevelFilter) -> Self
pub fn filter(self, module: Option<&str>, level: LevelFilter) -> Self
Adds a directive to the filter.
The given module (if any) will log at most the specified level provided. If no module is provided then the filter will apply to all log messages.
sourcepub fn try_parse(self, filters: &str) -> Result<Self>
pub fn try_parse(self, filters: &str) -> Result<Self>
Parses the directive string, returning an error if the given directive string is invalid.
See the env_logger
documentation for more details.
sourcepub fn parse(self, filters: &str) -> Self
pub fn parse(self, filters: &str) -> Self
Parses the directives string.
See the env_logger
documentation for more details.
Trait Implementations§
source§impl Debug for EnvFilterBuilder
impl Debug for EnvFilterBuilder
source§impl Default for EnvFilterBuilder
impl Default for EnvFilterBuilder
source§fn default() -> EnvFilterBuilder
fn default() -> EnvFilterBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for EnvFilterBuilder
impl RefUnwindSafe for EnvFilterBuilder
impl Send for EnvFilterBuilder
impl Sync for EnvFilterBuilder
impl Unpin for EnvFilterBuilder
impl UnwindSafe for EnvFilterBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request