Closed dabrain34 closed 2 years ago
This feature should be available, see the example from the README:
CombinedLogger::init(
vec![
TermLogger::new(LevelFilter::Warn, Config::default(), TerminalMode::Mixed, ColorChoice::Auto),
WriteLogger::new(LevelFilter::Info, Config::default(), File::create("my_rust_binary.log").unwrap()),
]
).unwrap();
The first logger logs Errors and Warnings, the second additionally includes Info.
yes but how could I change it on the fly ? I mean I connect the log to a ListView and I'd like to change the value in a settings panel to enable or disable some log levels without restarting the application.
Here is an example: https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio/-/merge_requests/25
yes but how could I change it on the fly ? I mean I connect the log to a ListView and I'd like to change the value in a settings panel to enable or disable some log levels without restarting the application.
Runtime configuration is not in scope of simplelog, it's config is set one time at start up. If you need this feature, you should take a look into more fully-featured logging frameworks like fern, slog or tracing.
If I understood correctly this is not available, so what would be the option to set the log level for a given write logger in a combined logger defined as this:
It seems that I can do it with
log::set_max_level
but I'd like to set it up only for the second one and keep the other ones at full log