Add http request logging

This commit is contained in:
Aadi Desai 2023-12-13 18:57:47 +00:00
parent e07eb0dba4
commit ee0e3042bb
Signed by: supleed2
SSH key fingerprint: SHA256:CkbNRs0yVzXEiUp2zd0PSxsfRUMFF9bLlKXtE1xEbKM
2 changed files with 5 additions and 2 deletions

View file

@ -17,7 +17,7 @@ shuttle-runtime = "0.35.0"
shuttle-shared-db = { version = "0.35.1", features = ["postgres"] } shuttle-shared-db = { version = "0.35.1", features = ["postgres"] }
sqlx = { version = "0.7.3", features = ["postgres", "runtime-tokio-native-tls"] } sqlx = { version = "0.7.3", features = ["postgres", "runtime-tokio-native-tls"] }
tokio = "1.34.0" 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" tracing = "0.1.40"
ulid = { version = "1.1.0", features = ["uuid", "serde"] } ulid = { version = "1.1.0", features = ["uuid", "serde"] }
uuid = "1.6.1" uuid = "1.6.1"

View file

@ -2,5 +2,8 @@ mod cal;
#[shuttle_runtime::main] #[shuttle_runtime::main]
async fn main(#[shuttle_shared_db::Postgres] pool: sqlx::PgPool) -> shuttle_axum::ShuttleAxum { 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())
} }