Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
enable tracing with feature
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriTimoz committed Dec 24, 2023
1 parent 05ed0fd commit 2ee546e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions minecraft-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
tracing = ["tracy-client", "tracing-tracy"]
6 changes: 4 additions & 2 deletions minecraft-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 2ee546e

Please sign in to comment.