-
Notifications
You must be signed in to change notification settings - Fork 840
Open
Description
Bug Report
Version
tracing v0.1.37
tracing-attributes v0.1.23
tracing-core v0.1.30
tracing-subscriber v0.3.16
tracing-log v0.1.3
Description
When a formatting argument of a tracing event macro (e.g. debug!) itself produces a tracing event, level filtering for the outer event is ignored. The level of the inner event does not seem to make a difference.
use tracing_subscriber::{filter::LevelFilter, prelude::*, Layer};
fn main() {
let everything_layer = tracing_subscriber::fmt::layer().with_writer(std::io::sink);
let stdout_layer = tracing_subscriber::fmt::layer()
.without_time()
.with_filter(LevelFilter::ERROR);
tracing_subscriber::registry()
.with(stdout_layer)
.with(everything_layer)
.init();
tracing::error!("just an error");
tracing::debug!("just debug");
tracing::debug!("instrumented {:?}", instrumented());
tracing::debug!("tracing in callee {:?}", nested());
tracing::debug!("directly nested {:?}", tracing::trace!(""));
}
#[tracing::instrument()]
fn instrumented() {}
fn nested() {
tracing::warn!("nested");
}Actual stdout:
ERROR tracing_bug: just an error
DEBUG tracing_bug: instrumented ()
DEBUG tracing_bug: tracing in callee ()
DEBUG tracing_bug: directly nested ()
Expected stdout:
ERROR tracing_bug: just an error
glaeqen, Yatekii, epontan, maddiemort, hamchapman and 1 more
Metadata
Metadata
Assignees
Labels
No labels