Open
Description
I have three examples of using the same subscriber here I have three examples of using the same subscriber, but for some reason the behaviour is completely different! let me know if you want me to repreduce this behavior in a repo
#[tokio::test]
async fn no_event_works_here() {
let trace = tracing_subscriber::fmt()
.with_max_level(tracing::Level::DEBUG)
.finish();
tracing::subscriber::with_default(trace, || async {
// no_event_works_here
tracing::debug!("only this but not");
}).await
}
#[tokio::test]
async fn only_few_event_work_here() {
let trace = tracing_subscriber::fmt()
.with_max_level(tracing::Level::DEBUG)
.finish()
.set_default();
// only this event work but not others
tracing::debug!("only this but not");
// this will not be displayed
sqlx::query("...").fetch_one({}).await.unwrap()
// some event that exist outside of the current crate
// are not visible, let me know if you want a way to
// repreduce the error
}
#[tokio::test]
async fn all_works() {
let trace = tracing_subscriber::fmt()
.with_max_level(tracing::Level::DEBUG)
.finish()
.set_global_default();
// all event are tracked here
// but I want to set up a subscriber for each test
// similar to how "tracing::subscriber::with_default" looks like
tracing::debug!("only this but not")
}
Metadata
Metadata
Assignees
Labels
No labels