From ee0e3042bbb6d3eba9873995250e05506d911c63 Mon Sep 17 00:00:00 2001 From: Aadi Desai <21363892+supleed2@users.noreply.github.com> Date: Wed, 13 Dec 2023 18:57:47 +0000 Subject: [PATCH] Add http request logging --- Cargo.toml | 2 +- src/main.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6585514..508b4c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ shuttle-runtime = "0.35.0" shuttle-shared-db = { version = "0.35.1", features = ["postgres"] } sqlx = { version = "0.7.3", features = ["postgres", "runtime-tokio-native-tls"] } tokio = "1.34.0" -tower-http = { version = "0.5.0", features = ["fs"] } +tower-http = { version = "0.5.0", features = ["fs","trace"] } tracing = "0.1.40" ulid = { version = "1.1.0", features = ["uuid", "serde"] } uuid = "1.6.1" diff --git a/src/main.rs b/src/main.rs index 5590c7e..b602569 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,5 +2,8 @@ mod cal; #[shuttle_runtime::main] async fn main(#[shuttle_shared_db::Postgres] pool: sqlx::PgPool) -> shuttle_axum::ShuttleAxum { - Ok(axum::Router::new().nest("/", cal::router(pool)).into()) + Ok(axum::Router::new() + .nest("/", cal::router(pool)) + .layer(tower_http::trace::TraceLayer::new_for_http()) + .into()) }