From 2131532de46ed0e48be7fc7b6c5117e2bae3a3e2 Mon Sep 17 00:00:00 2001 From: ooochoche Date: Fri, 11 Oct 2024 12:09:53 +0100 Subject: [PATCH] dev: integrate tokio-console --- .cargo/config.toml | 3 +++ Cargo.lock | 1 + Cargo.toml | 2 +- src/main.rs | 5 ++++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index e58648cf2..f64410a12 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -3,3 +3,6 @@ linker = "x86_64-linux-gnu-gcc" [target.aarch64-unknown-linux-gnu] linker = "aarch64-linux-gnu-gcc" + +[build] +rustflags = ["--cfg", "tokio_unstable"] diff --git a/Cargo.lock b/Cargo.lock index e3fd13114..7476618b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11998,6 +11998,7 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", + "tracing", "windows-sys 0.52.0", ] diff --git a/Cargo.toml b/Cargo.toml index c34e34d8e..f98c69fdc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -101,7 +101,7 @@ thiserror = { version = "1", default-features = false } # Futures async-trait = { version = "0.1", default-features = false } futures = { version = "0.3", default-features = false } -tokio = { version = "1", features = ["macros"] } +tokio = { version = "1", features = ["macros", "tracing"] } # Network tower = { version = "0.4", default-features = false } diff --git a/src/main.rs b/src/main.rs index dedf9397f..59a40fbdc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -107,7 +107,10 @@ fn setup_tracing() -> Result<()> { let filter = EnvFilter::builder().from_env()?; let stdout = tracing_subscriber::fmt::layer().with_filter(filter).boxed(); - tracing_subscriber::registry().with(stacked_layer).with(stdout).init(); + // Add the console subscriber + let console_layer = console_subscriber::spawn(); + + tracing_subscriber::registry().with(console_layer).with(stacked_layer).with(stdout).init(); Ok(()) }