diff --git a/Cargo.lock b/Cargo.lock index 0e41c46..2415f1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1310,6 +1310,26 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +[[package]] +name = "pin-project" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + [[package]] name = "pin-project-lite" version = "0.2.13" @@ -2075,6 +2095,18 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-actix-web" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c0b08ce08cbde6a96fc1e4ebb8132053e53ec7a5cd27eef93ede6b73ebbda06" +dependencies = [ + "actix-web", + "pin-project", + "tracing", + "uuid", +] + [[package]] name = "tracing-attributes" version = "0.1.26" @@ -2482,6 +2514,7 @@ dependencies = [ "sqlx", "tokio", "tracing", + "tracing-actix-web", "tracing-bunyan-formatter", "tracing-log", "tracing-subscriber", diff --git a/Cargo.toml b/Cargo.toml index 7ed5e58..8bd7c2d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,7 @@ tracing-bunyan-formatter = "0.3" tracing-log = "0.1" once_cell = "1" secrecy = { version = "0.8", features = ["serde"] } +tracing-actix-web = "0.7" [dev-dependencies] reqwest = { version = "0.11", features = ["json"] } diff --git a/src/routes/subscriptions.rs b/src/routes/subscriptions.rs index f00b371..27457b2 100644 --- a/src/routes/subscriptions.rs +++ b/src/routes/subscriptions.rs @@ -14,7 +14,6 @@ pub struct FormData { name = "Adding a new subscriber", skip(form, pool), fields( - request_id = %Uuid::new_v4(), subscriber_email = %form.email, subscriber_name = %form.name, ) diff --git a/src/startup.rs b/src/startup.rs index 991fbd3..3424d19 100644 --- a/src/startup.rs +++ b/src/startup.rs @@ -1,7 +1,8 @@ use std::net::TcpListener; -use actix_web::{dev::Server, middleware::Logger, web, App, HttpServer}; +use actix_web::{dev::Server, web, App, HttpServer}; use sqlx::PgPool; +use tracing_actix_web::TracingLogger; use crate::routes::{health_check, subscribe}; @@ -9,7 +10,7 @@ pub fn run(listener: TcpListener, db_pool: PgPool) -> Result