diff --git a/Cargo.lock b/Cargo.lock index 55fad7a..17d0da9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -815,6 +815,7 @@ dependencies = [ "tempfile", "tokio", "tokio-util", + "tower-http", "tracing", "tracing-subscriber", "zip", @@ -1133,6 +1134,7 @@ dependencies = [ "tower", "tower-layer", "tower-service", + "tracing", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 250549f..529a726 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ mime_guess = "2.0.4" tempfile = "3.3.0" tokio = { version = "1.19.2", features = ["full"] } tokio-util = { version = "0.7.3", features = ["io"] } +tower-http = { version = "0.3.4", features = ["trace"] } tracing = "0.1.35" tracing-subscriber = { version = "0.3.14", features = ["env-filter"] } zip = "0.6.2" diff --git a/src/main.rs b/src/main.rs index 970f787..90c89b6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,7 @@ use std::{fs, path::Path}; use axum::Extension; use color_eyre::{eyre::eyre, Result}; use projects::AuthToken; +use tower_http::trace::TraceLayer; use tracing_subscriber::prelude::*; mod projects; @@ -14,7 +15,7 @@ async fn main() -> Result<()> { tracing_subscriber::registry() .with(tracing_subscriber::filter::EnvFilter::new( - std::env::var("RUST_LOG").unwrap_or_else(|_| "debug".into()), + std::env::var("RUST_LOG").unwrap_or_else(|_| "debug,hyper=info".into()), )) .with(tracing_subscriber::fmt::layer()) .init(); @@ -32,7 +33,9 @@ async fn main() -> Result<()> { fs::create_dir_all(archive_dir)?; } - let app = routes::router().layer(Extension(AuthToken(upload_token))); + let app = routes::router() + .layer(Extension(AuthToken(upload_token))) + .layer(TraceLayer::new_for_http()); let port: u16 = std::env::var("PORT") .map(|s| s.parse().unwrap())