Struct flexi_logger::LogSpecBuilder 
source · pub struct LogSpecBuilder { /* private fields */ }Expand description
Builder for LogSpecification.
Example
Start with a programmatically built log specification, and use the
LoggerHandle to apply a modified version of the log specification
at a later point in time:
use flexi_logger::{Logger, LogSpecification};
use log::LevelFilter;
fn main() {
    // Build the initial log specification
    let mut builder = LogSpecification::builder();
    builder
        .default(LevelFilter::Info)
        .module("karl", LevelFilter::Debug);
    // Initialize Logger, keep builder alive
    let mut logger = Logger::with(builder.build())
        // your logger configuration goes here, as usual
        .start()
        .unwrap_or_else(|e| panic!("Logger initialization failed with {}", e));
    // ...
    // Modify builder and update the logger
    builder
        .default(LevelFilter::Error)
        .remove("karl")
        .module("emma", LevelFilter::Trace);
    logger.set_new_spec(builder.build());
    // ...
}Implementations§
source§impl LogSpecBuilder
 
impl LogSpecBuilder
sourcepub fn from_module_filters(module_filters: &[ModuleFilter]) -> Self
 
pub fn from_module_filters(module_filters: &[ModuleFilter]) -> Self
Creates a LogSpecBuilder from given module filters.
sourcepub fn default(&mut self, lf: LevelFilter) -> &mut Self
 
pub fn default(&mut self, lf: LevelFilter) -> &mut Self
Adds a default log level filter, or updates the default log level filter.
sourcepub fn module<M: AsRef<str>>(
    &mut self,
    module_name: M,
    lf: LevelFilter
) -> &mut Self
 
pub fn module<M: AsRef<str>>( &mut self, module_name: M, lf: LevelFilter ) -> &mut Self
Adds a log level filter, or updates the log level filter, for a module.
sourcepub fn remove<M: AsRef<str>>(&mut self, module_name: M) -> &mut Self
 
pub fn remove<M: AsRef<str>>(&mut self, module_name: M) -> &mut Self
Adds a log level filter, or updates the log level filter, for a module.
sourcepub fn insert_modules_from(&mut self, other: LogSpecification) -> &mut Self
 
pub fn insert_modules_from(&mut self, other: LogSpecification) -> &mut Self
Adds log level filters from a LogSpecification.
sourcepub fn finalize(self) -> LogSpecification
 
pub fn finalize(self) -> LogSpecification
Creates a log specification without text filter.
sourcepub fn finalize_with_textfilter(self, tf: Regex) -> LogSpecification
 
pub fn finalize_with_textfilter(self, tf: Regex) -> LogSpecification
Creates a log specification with text filter.
This method is only avaible if the dafault feature textfilter is not switched off.
sourcepub fn build(&self) -> LogSpecification
 
pub fn build(&self) -> LogSpecification
Creates a log specification without being consumed.
sourcepub fn build_with_textfilter(&self, tf: Option<Regex>) -> LogSpecification
 
pub fn build_with_textfilter(&self, tf: Option<Regex>) -> LogSpecification
Creates a log specification without being consumed, optionally with a text filter.
This method is only avaible if the dafault feature textfilter is not switched off.
Trait Implementations§
source§impl Clone for LogSpecBuilder
 
impl Clone for LogSpecBuilder
source§fn clone(&self) -> LogSpecBuilder
 
fn clone(&self) -> LogSpecBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read more