logo
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

Initializes the filter builder with defaults.

Initializes the filter builder from an environment.

Adds a directive to the filter for a specific module.

Adds a directive to the filter for all modules.

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.

Parses the directives string.

See the Enabling Logging section for more details.

Build a log filter.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.