Closed aress31 closed 2 years ago
Which led me to look at add_filter_ignore. However, I found nowhere in the documentation how to call add_filter_ignore on a Config::default().
Indeed, you can't do that. You are supposed to use the ConfigBuilder
, if you want to adjust any default parameters. But it seems you figured that out already.
EDIT: I just managed to somehow silence reqwest, see the following, but surely there must be a more elegant solution - maybe using wildcards?
You can see the logic for skipping log messages here: https://github.com/Drakulix/simplelog.rs/blob/95275c88b14f204a5e8278cd98072e4ffb0bc7d8/src/loggers/logging.rs#L226
For simplicity and performance it is no fancy regex or anything supporting wildcards, but just a starts_with
check for the path.
So something like this should be sufficient:
let config = ConfigBuilder::new()
.add_filter_ignore_str("reqwest")
.build();
(Config
implements Clone
if you want to use the same config for multiple loggers.)
Brilliant, thanks @Drakulix !
I am looking at ways to silence
reqwest
, see https://github.com/seanmonstar/reqwest/discussions/1578#discussioncomment-3172945.Which led me to look at add_filter_ignore. However, I found nowhere in the documentation how to call add_filter_ignore on a
Config::default()
.This is my current code:
If you could help with this, that would be wonderful!
EDIT: I just managed to somehow silence
reqwest
, see the following, but surely there must be a more elegant solution - maybe using wildcards?