diff --git a/crates/bevy_utils/Cargo.toml b/crates/bevy_utils/Cargo.toml index c1555d8ba94bb..c1c64371a1e88 100644 --- a/crates/bevy_utils/Cargo.toml +++ b/crates/bevy_utils/Cargo.toml @@ -9,15 +9,17 @@ license = "MIT OR Apache-2.0" keywords = ["bevy"] [features] -default = ["std", "serde"] +default = ["std", "serde", "tracing"] std = [ "alloc", - "tracing/std", + "log/std", "ahash/std", "dep:thread_local", "ahash/runtime-rng", + "tracing?/std", ] alloc = ["hashbrown/default"] +tracing = ["dep:tracing"] detailed_trace = [] serde = ["hashbrown/serde"] @@ -25,7 +27,8 @@ serde = ["hashbrown/serde"] ahash = { version = "0.8.7", default-features = false, features = [ "compile-time-rng", ] } -tracing = { version = "0.1", default-features = false } +log = { version = "0.4", default-features = false } +tracing = { version = "0.1", default-features = false, optional = true } hashbrown = { version = "0.14.2", default-features = false } bevy_utils_proc_macros = { version = "0.15.0-dev", path = "macros" } thread_local = { version = "1.0", optional = true } diff --git a/crates/bevy_utils/src/lib.rs b/crates/bevy_utils/src/lib.rs index 1865f62cf999a..45900020e7ec1 100644 --- a/crates/bevy_utils/src/lib.rs +++ b/crates/bevy_utils/src/lib.rs @@ -42,8 +42,16 @@ pub use hashbrown; #[cfg(feature = "std")] pub use parallel_queue::*; pub use time::*; + +#[cfg(feature = "tracing")] pub use tracing; +#[cfg(not(feature = "tracing"))] +// In cases where the tracing crate cannot be used, we can instead rely on log to +// provide most of the required functionality. +// Exporting log as tracing allows this decision to have minimal impact on consumers. +pub use log as tracing; + #[cfg(feature = "alloc")] use alloc::boxed::Box;