pub struct Builder { /* private fields */ }
Expand description
A builder for a log filter.
It can be used to parse a set of directives from a string before building
a Filter
instance.
§Example
use env_logger::filter::Builder;
let mut builder = Builder::new();
// Parse a logging filter from an environment variable.
if let Ok(rust_log) = env::var("RUST_LOG") {
builder.parse(&rust_log);
}
let filter = builder.build();
Implementations§
source§impl Builder
impl Builder
sourcepub fn filter_module(&mut self, module: &str, level: LevelFilter) -> &mut Self
pub fn filter_module(&mut self, module: &str, level: LevelFilter) -> &mut Self
Adds a directive to the filter for a specific module.
sourcepub fn filter_level(&mut self, level: LevelFilter) -> &mut Self
pub fn filter_level(&mut self, level: LevelFilter) -> &mut Self
Adds a directive to the filter for all modules.
sourcepub fn filter(&mut self, module: Option<&str>, level: LevelFilter) -> &mut Self
pub fn filter(&mut self, module: Option<&str>, level: LevelFilter) -> &mut 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 parse(&mut self, filters: &str) -> &mut Self
pub fn parse(&mut self, filters: &str) -> &mut Self
Parses the directives string.
See the Enabling Logging section for more details.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
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