Struct env_logger::filter::Builder[][src]

pub struct Builder { /* fields omitted */ }

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

#[macro_use]
extern crate log;
extern crate env_logger;

use std::env;
use std::io;
use env_logger::filter::Builder;

fn main() {
    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();
}

Methods

impl Builder
[src]

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

impl Default for Builder
[src]

Returns the "default value" for a type. Read more

impl Debug for Builder
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Builder

impl Sync for Builder