Consider the following code:
let config = ConfigBuilder::default()
.set_time_level(LevelFilter::Error)
.set_location_level(LevelFilter::Error)
.build();
let _ = CombinedLogger::init(vec![
TermLogger::new(
LevelFilter::Trace,
config.clone(),
TerminalMode::Mixed,
ColorChoice::Auto,
),
WriteLogger::new(
LevelFilter::Trace,
config,
File::create("file.log").expect("Failed to create a file logger!"),
),
])
.expect("Failed to create a combined logger!");
It will print time level and location data for all message levels (not just error). The only way I found to modify the behavior was to use the Off level, which does turn it off but it does so for all levels, which is quite different and nowhere near as useful.
Consider the following code:
It will print time level and location data for all message levels (not just error). The only way I found to modify the behavior was to use the
Offlevel, which does turn it off but it does so for all levels, which is quite different and nowhere near as useful.