1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-02-22 18:33:18 +01:00

Update to latest version of actix-web.

This commit is contained in:
Luca Palmieri 2020-09-27 16:46:31 +01:00
parent 993b6e2f68
commit 209ed46498
3 changed files with 11 additions and 8 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "tracing-actix-web"
version = "0.1.2-alpha.0"
version = "0.2.0"
authors = ["Luca Palmieri <rust@lpalmieri.com>"]
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"

View File

@ -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

View File

@ -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,
);