mirror of
https://github.com/actix/actix-extras.git
synced 2025-02-22 18:33:18 +01:00
Add request id
This commit is contained in:
parent
4ef6f95608
commit
5da38fa16d
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tracing-actix-web"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
authors = ["Luca Palmieri <rust@lpalmieri.com>"]
|
||||
edition = "2018"
|
||||
|
||||
@ -20,6 +20,7 @@ actix-web = "2"
|
||||
tracing = "0.1.19"
|
||||
tracing-futures = "0.2.4"
|
||||
futures = "0.3.5"
|
||||
uuid = { version = "0.8.1", features = ["v4"] }
|
||||
|
||||
[dev-dependencies]
|
||||
tracing-subscriber = { version = "0.2.12", features = ["registry", "env-filter"] }
|
||||
|
@ -23,6 +23,7 @@ use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use tracing::Span;
|
||||
use tracing_futures::Instrument;
|
||||
use uuid::Uuid;
|
||||
|
||||
/// `TracingLogger` is a middleware to log request and response info in a structured format.
|
||||
///
|
||||
@ -136,6 +137,7 @@ where
|
||||
request_path = %req.path(),
|
||||
user_agent = %user_agent,
|
||||
client_ip_address = %req.connection_info().remote().unwrap_or(""),
|
||||
request_id = %Uuid::new_v4(),
|
||||
status_code = tracing::field::Empty,
|
||||
);
|
||||
let fut = self.service.call(req);
|
||||
|
Loading…
x
Reference in New Issue
Block a user