pub struct ReconfigurationHandle { /* private fields */ }
Expand description

Allows reconfiguring the logger while it is in use (see Logger::start_reconfigurable() ).

Example

Use the reconfigurability feature and build the log spec programmatically.

extern crate log;
extern crate flexi_logger;
use flexi_logger::{Logger, LogSpecBuilder};
use log::LevelFilter;

fn main() {
    // Build the initial log specification
    let mut builder = LogSpecBuilder::new();  // default is LevelFilter::Off
    builder.default(LevelFilter::Info);
    builder.module("karl", LevelFilter::Debug);

    // Initialize Logger, keep builder alive
    let mut logger_reconf_handle = Logger::with(builder.build())
        // your logger configuration goes here, as usual
        .start_reconfigurable()
        .unwrap_or_else(|e| panic!("Logger initialization failed with {}", e));

    // ...

    // Modify builder and update the logger
    builder.default(LevelFilter::Error);
    builder.remove("karl");
    builder.module("emma", LevelFilter::Trace);

    logger_reconf_handle.set_new_spec(builder.build());

    // ...
}

Implementations§

Allows specifying a new LogSpecification for the current logger.

Allows specifying a new LogSpecification for the current logger.

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.