From 6f5607785d2dc7ea0ede03c11914d32cdb305953 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Wed, 25 Sep 2024 07:44:35 +0000 Subject: [PATCH] core: Fix compile errors from __log_rejection (#2933) --- axum-core/src/lib.rs | 5 +++++ axum-core/src/macros.rs | 6 +++--- axum-extra/Cargo.toml | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) 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 06aa0766a9..7a964b003e 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"]