From 209ed4649873d04558d73e519b4a04b3e73448c5 Mon Sep 17 00:00:00 2001 From: Luca Palmieri Date: Sun, 27 Sep 2020 16:46:31 +0100 Subject: [PATCH] Update to latest version of actix-web. --- Cargo.toml | 4 ++-- README.md | 9 ++++++--- src/lib.rs | 6 +++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7e61e39b9..5ce3c7d20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tracing-actix-web" -version = "0.1.2-alpha.0" +version = "0.2.0" authors = ["Luca Palmieri "] edition = "2018" @@ -16,7 +16,7 @@ keywords = ["http", "actix-web", "tracing", "logging"] categories = ["asynchronous", "web-programming"] [dependencies] -actix-web = "2" +actix-web = "3" tracing = "0.1.19" tracing-futures = "0.2.4" futures = "0.3.5" diff --git a/README.md b/README.md index 671de0156..96dd64316 100644 --- a/README.md +++ b/README.md @@ -22,13 +22,16 @@ Add `tracing-actix-web` to your dependencies: ```toml [dependencies] # ... -tracing-actix-web = "0.1" +tracing-actix-web = "0.2" ``` If you are using [`cargo-edit`](https://github.com/killercup/cargo-edit), run ```bash cargo add tracing-actix-web ``` +`tracing-actix-web` `0.2.x` depends on `actix-web` `3.x.x`. +If you are using `actix-web` `2.x.x` use `tracing-actix-web` `0.1.x`. + ## Usage example Register `TracingLogger` as a middleware for your application using `.wrap` on `App`. @@ -75,8 +78,8 @@ fn main() { } ``` -[`TracingLogger`]: https://docs.rs/tracing-actix-web/0.1.0/tracing-actix-web/#struct.TracingLogger.html +[`TracingLogger`]: https://docs.rs/tracing-actix-web/0.2.0/tracing-actix-web/#struct.TracingLogger.html [`actix-web`]: https://docs.rs/actix-web -[`Logger`]: https://docs.rs/actix-web/2.0.0/actix_web/middleware/struct.Logger.html +[`Logger`]: https://docs.rs/actix-web/3.0.0/actix_web/middleware/struct.Logger.html [`log`]: https://docs.rs/log [`tracing`]: https://docs.rs/tracing diff --git a/src/lib.rs b/src/lib.rs index c9ba28fe7..369f47e91 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,7 +12,7 @@ //! //! [`TracingLogger`]: #struct.TracingLogger.html //! [`actix-web`]: https://docs.rs/actix-web -//! [`Logger`]: https://docs.rs/actix-web/2.0.0/actix_web/middleware/struct.Logger.html +//! [`Logger`]: https://docs.rs/actix-web/3.0.2/actix_web/middleware/struct.Logger.html //! [`log`]: https://docs.rs/log //! [`tracing`]: https://docs.rs/tracing use actix_web::dev::{Service, ServiceRequest, ServiceResponse, Transform}; @@ -83,7 +83,7 @@ use uuid::Uuid; /// ``` /// /// [`actix-web`]: https://docs.rs/actix-web -/// [`Logger`]: https://docs.rs/actix-web/2.0.0/actix_web/middleware/struct.Logger.html +/// [`Logger`]: https://docs.rs/actix-web/3.0.2/actix_web/middleware/struct.Logger.html /// [`log`]: https://docs.rs/log /// [`tracing`]: https://docs.rs/tracing pub struct TracingLogger; @@ -136,7 +136,7 @@ where "Request", request_path = %req.path(), user_agent = %user_agent, - client_ip_address = %req.connection_info().remote().unwrap_or(""), + client_ip_address = %req.connection_info().realip_remote_addr().unwrap_or(""), request_id = %Uuid::new_v4(), status_code = tracing::field::Empty, );