From 2f27752a9912f03ed64e2b29e1ea06ebb4b09e83 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Thu, 12 Oct 2023 12:12:17 -0700 Subject: [PATCH] chore: remove `env_logger` from `hyper` example Currently, the `hyper_echo` example uses the `tracing-log` env logger support for some weird reason. I believe this is due to Hyper previously using `log` rather than `tracing`. However, `hyper` now emits native `tracing` diagnostics, so all the `env_logger` nonsense can just be removed from the example. This branch does that. ; Conflicts: ; examples/Cargo.toml ; examples/examples/hyper-echo.rs --- examples/Cargo.toml | 3 --- examples/examples/hyper-echo.rs | 5 ++--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 25e56247bb..1f0be6d943 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -30,9 +30,6 @@ serde_json = "1.0.82" futures = "0.3.21" tokio = { version = "1.20.1", features = ["full"] } -# env-logger example -env_logger = "0.9.0" - # tower examples tower = { version = "0.4.13", features = ["full"] } http = "0.2.8" diff --git a/examples/examples/hyper-echo.rs b/examples/examples/hyper-echo.rs index f0396d19cf..a4dcd905e7 100644 --- a/examples/examples/hyper-echo.rs +++ b/examples/examples/hyper-echo.rs @@ -92,10 +92,9 @@ async fn echo(req: Request) -> Result, hyper::Error> { #[tokio::main] async fn main() -> Result<(), Box> { - let subscriber = tracing_subscriber::fmt() + tracing_subscriber::fmt() .with_max_level(Level::TRACE) - .finish(); - tracing::subscriber::set_global_default(subscriber)?; + .init(); let local_addr: std::net::SocketAddr = ([127, 0, 0, 1], 3000).into(); let server_span = span!(Level::TRACE, "server", %local_addr);