I use reqwest to make HTTP requests.
And I want to see what happens under the hood.
In my application I use env_logger.
And before for debugging I just ran:
RUST_LOG=reqwest=trace,hyper=trace ./myapp
But now I see only reqwest logs.
I look at hyper code, and looks like they switched to tracing crate. Any way to redirect tracing data to stdout, if take into consideration that I do not directly depend on hyper, only via reqwest?
You must enable a Subscriber to do anything with the log messages created by tracing, like printing them to stdout. The tracing-subscriber crate provides a good Subscriber. Re-using the RUST_LOG environment variable and showing the hyper logs should be as easy as adding the following to your code:
Cargo.toml:
[dependencies]
tracing-subscriber = { version = "^0.3.16", features = ["env-filter"] }