diff --git a/axum-core/src/lib.rs b/axum-core/src/lib.rs index cd1dc2ee60..134c566b30 100644 --- a/axum-core/src/lib.rs +++ b/axum-core/src/lib.rs @@ -50,6 +50,11 @@ #[macro_use] pub(crate) mod macros; +#[doc(hidden)] // macro helpers +pub mod __private { + #[cfg(feature = "tracing")] + pub use tracing; +} mod error; mod ext_traits; diff --git a/axum-core/src/macros.rs b/axum-core/src/macros.rs index 7d7238189d..aa99ba402e 100644 --- a/axum-core/src/macros.rs +++ b/axum-core/src/macros.rs @@ -9,12 +9,12 @@ macro_rules! __log_rejection { status = $status:expr, ) => { { - tracing::event!( + $crate::__private::tracing::event!( target: "axum::rejection", - tracing::Level::TRACE, + $crate::__private::tracing::Level::TRACE, status = $status.as_u16(), body = $body_text, - rejection_type = std::any::type_name::<$ty>(), + rejection_type = ::std::any::type_name::<$ty>(), "rejecting request", ); } diff --git a/axum-extra/Cargo.toml b/axum-extra/Cargo.toml index bf0ba2a478..eea44bddb6 100644 --- a/axum-extra/Cargo.toml +++ b/axum-extra/Cargo.toml @@ -34,7 +34,7 @@ json-lines = [ multipart = ["dep:multer"] protobuf = ["dep:prost"] query = ["dep:serde_html_form"] -tracing = ["dep:tracing", "axum-core/tracing", "axum/tracing"] +tracing = ["axum-core/tracing", "axum/tracing"] typed-header = ["dep:headers"] typed-routing = ["dep:axum-macros", "dep:percent-encoding", "dep:serde_html_form", "dep:form_urlencoded"]