Skip to content

Commit

Permalink
chore: remove env_logger from hyper example
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hawkw committed Oct 12, 2023
1 parent f96846d commit 2f27752
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
3 changes: 0 additions & 3 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 2 additions & 3 deletions examples/examples/hyper-echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,9 @@ async fn echo(req: Request<Body>) -> Result<Response<Body>, hyper::Error> {

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
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);
Expand Down

0 comments on commit 2f27752

Please sign in to comment.