diff --git a/Cargo.lock b/Cargo.lock index 21d749727..dab12a56b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3745,6 +3745,7 @@ dependencies = [ "tokio-stream", "toml", "tracing", + "tracing-actix-web", "tracing-subscriber", "tracing-trace", "url", @@ -3984,6 +3985,12 @@ dependencies = [ "syn 2.0.48", ] +[[package]] +name = "mutually_exclusive_features" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d02c0b00610773bb7fc61d85e13d86c7858cbdf00e1a120bfc41bc055dbaa0e" + [[package]] name = "nom" version = "7.1.3" @@ -4369,6 +4376,26 @@ dependencies = [ "siphasher 0.3.11", ] +[[package]] +name = "pin-project" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "pin-project-lite" version = "0.2.13" @@ -5715,6 +5742,19 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-actix-web" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fe0d5feac3f4ca21ba33496bcb1ccab58cca6412b1405ae80f0581541e0ca78" +dependencies = [ + "actix-web", + "mutually_exclusive_features", + "pin-project", + "tracing", + "uuid", +] + [[package]] name = "tracing-attributes" version = "0.1.27" diff --git a/meilisearch/Cargo.toml b/meilisearch/Cargo.toml index 2a7b5ade1..60b91207e 100644 --- a/meilisearch/Cargo.toml +++ b/meilisearch/Cargo.toml @@ -107,6 +107,7 @@ url = { version = "2.5.0", features = ["serde"] } tracing = "0.1.40" tracing-subscriber = "0.3.18" tracing-trace = { version = "0.1.0", path = "../tracing-trace" } +tracing-actix-web = "0.7.9" [dev-dependencies] actix-rt = "2.9.0" diff --git a/meilisearch/src/lib.rs b/meilisearch/src/lib.rs index 2ebed39a3..56149ec6c 100644 --- a/meilisearch/src/lib.rs +++ b/meilisearch/src/lib.rs @@ -136,7 +136,7 @@ pub fn create_app( .allow_any_method() .max_age(86_400), // 24h ) - .wrap(actix_web::middleware::Logger::default()) + .wrap(tracing_actix_web::TracingLogger::default()) .wrap(actix_web::middleware::Compress::default()) .wrap(actix_web::middleware::NormalizePath::new(actix_web::middleware::TrailingSlash::Trim)) } diff --git a/meilisearch/src/main.rs b/meilisearch/src/main.rs index 734f50de3..ccbe761fe 100644 --- a/meilisearch/src/main.rs +++ b/meilisearch/src/main.rs @@ -35,7 +35,7 @@ fn setup(opt: &Opt) -> anyhow::Result { let subscriber = tracing_subscriber::registry().with(route_layer).with( tracing_subscriber::fmt::layer() .with_line_number(true) - .with_span_events(tracing_subscriber::fmt::format::FmtSpan::ACTIVE) + .with_span_events(tracing_subscriber::fmt::format::FmtSpan::NEW) .with_filter( tracing_subscriber::filter::LevelFilter::from_str(&opt.log_level.to_string()) .unwrap(),