Silence reqwest debug/trace level logging #1578
-
Hi, it has been a while now that I am trying to find a way to silence 17:36:35 [DEBUG] (2) reqwest::connect: starting new connection: https://login.microsoft.com/
17:36:35 [DEBUG] (2) reqwest::async_impl::client: response '400 Bad Request' for https://login.microsoft.com/common/oauth2/token
17:36:35 [DEBUG] (1) raadef: [1/30] (MSGraphApi) REDACTED@contosco:REDACTED -> INVALID_TENANT (AADSTS900023)
17:36:37 [DEBUG] (2) reqwest::async_impl::client: response '400 Bad Request' for https://login.microsoft.com/common/oauth2/token
17:36:37 [DEBUG] (1) raadef: [2/30] (MSGraphApi) REDACTED@contosco:REDACTED -> INVALID_TENANT (AADSTS900023) How could I please silence the output? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
This depends on what your logging setup is like. If you're using |
Beta Was this translation helpful? Give feedback.
-
@Victor-N-Suadicani, my setup is pretty basic, I simply rely on the use simplelog::{
debug, error, info, trace, ColorChoice, CombinedLogger, Config, TermLogger, TerminalMode,
WriteLogger,
};
--- SNIP ---
let _ = CombinedLogger::init(vec![
TermLogger::new(
args.verbose.log_level_filter(),
Config::default(),
TerminalMode::Stdout,
ColorChoice::Auto,
),
WriteLogger::new(
args.verbose.log_level_filter(),
Config::default(),
File::create(args.outfile.clone()).unwrap(),
),
]);
debug!("CLI arguments: {:#?}", args); And then manually format my output, that is why I would like to totally silence |
Beta Was this translation helpful? Give feedback.
This depends on what your logging setup is like. If you're using
env_logger
for instance, you probably have theRUST_LOG
environment set totrace
, which will simply enable all trace logs from all crates. If you want to restrictreqwest
to info and above, you can just setRUST_LOG=trace,reqwest=info
which will set all crates to trace level, except for reqwest which will be at the info level. But again, depends on how your logging setup is like.