diff --git a/minecraft-server/Cargo.toml b/minecraft-server/Cargo.toml index afb39987..c613af49 100644 --- a/minecraft-server/Cargo.toml +++ b/minecraft-server/Cargo.toml @@ -13,12 +13,12 @@ minecraft-protocol = { path="../minecraft-protocol" } minecraft-positions = { path="../minecraft-positions" } minecraft-entities-derive = { path="../minecraft-entities-derive" } rand = "0.8.4" -tracy-client = { version = "0.16.4", features = ["enable"] } -tracing-tracy = { version = "0.10.4", features = ["enable", "system-tracing"] } +tracy-client = { version = "0.16.4", features = ["enable"], optional = true} +tracing-tracy = { version = "0.10.4", features = ["enable", "system-tracing"], optional = true} tracing-subscriber = "0.3.18" log = "0.4.17" tracing = { version = "0.1", features = ["attributes"] } [features] default = [] -tracing = [] \ No newline at end of file +tracing = ["tracy-client", "tracing-tracy"] \ No newline at end of file diff --git a/minecraft-server/src/main.rs b/minecraft-server/src/main.rs index 0d985406..d0f414d7 100644 --- a/minecraft-server/src/main.rs +++ b/minecraft-server/src/main.rs @@ -31,8 +31,10 @@ async fn main() { use tracing_subscriber::{fmt, layer::SubscriberExt, Registry}; let subscriber = Registry::default() - .with(tracing_tracy::TracyLayer::new()) - .with(fmt::layer()); + .with(fmt::layer()); + #[cfg(feature = "tracing")] + let subscriber = subscriber + .with(tracing_tracy::TracyLayer::new()); tracing::subscriber::set_global_default(subscriber) .expect("setting up tracing");