mirror of
https://github.com/actix/actix-extras.git
synced 2025-02-23 02:43:16 +01:00
Update to latest version of actix-web.
This commit is contained in:
parent
993b6e2f68
commit
209ed46498
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tracing-actix-web"
|
name = "tracing-actix-web"
|
||||||
version = "0.1.2-alpha.0"
|
version = "0.2.0"
|
||||||
authors = ["Luca Palmieri <rust@lpalmieri.com>"]
|
authors = ["Luca Palmieri <rust@lpalmieri.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ keywords = ["http", "actix-web", "tracing", "logging"]
|
|||||||
categories = ["asynchronous", "web-programming"]
|
categories = ["asynchronous", "web-programming"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "2"
|
actix-web = "3"
|
||||||
tracing = "0.1.19"
|
tracing = "0.1.19"
|
||||||
tracing-futures = "0.2.4"
|
tracing-futures = "0.2.4"
|
||||||
futures = "0.3.5"
|
futures = "0.3.5"
|
||||||
|
@ -22,13 +22,16 @@ Add `tracing-actix-web` to your dependencies:
|
|||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# ...
|
# ...
|
||||||
tracing-actix-web = "0.1"
|
tracing-actix-web = "0.2"
|
||||||
```
|
```
|
||||||
If you are using [`cargo-edit`](https://github.com/killercup/cargo-edit), run
|
If you are using [`cargo-edit`](https://github.com/killercup/cargo-edit), run
|
||||||
```bash
|
```bash
|
||||||
cargo add tracing-actix-web
|
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
|
## Usage example
|
||||||
|
|
||||||
Register `TracingLogger` as a middleware for your application using `.wrap` on `App`.
|
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
|
[`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
|
[`log`]: https://docs.rs/log
|
||||||
[`tracing`]: https://docs.rs/tracing
|
[`tracing`]: https://docs.rs/tracing
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
//!
|
//!
|
||||||
//! [`TracingLogger`]: #struct.TracingLogger.html
|
//! [`TracingLogger`]: #struct.TracingLogger.html
|
||||||
//! [`actix-web`]: https://docs.rs/actix-web
|
//! [`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
|
//! [`log`]: https://docs.rs/log
|
||||||
//! [`tracing`]: https://docs.rs/tracing
|
//! [`tracing`]: https://docs.rs/tracing
|
||||||
use actix_web::dev::{Service, ServiceRequest, ServiceResponse, Transform};
|
use actix_web::dev::{Service, ServiceRequest, ServiceResponse, Transform};
|
||||||
@ -83,7 +83,7 @@ use uuid::Uuid;
|
|||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [`actix-web`]: https://docs.rs/actix-web
|
/// [`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
|
/// [`log`]: https://docs.rs/log
|
||||||
/// [`tracing`]: https://docs.rs/tracing
|
/// [`tracing`]: https://docs.rs/tracing
|
||||||
pub struct TracingLogger;
|
pub struct TracingLogger;
|
||||||
@ -136,7 +136,7 @@ where
|
|||||||
"Request",
|
"Request",
|
||||||
request_path = %req.path(),
|
request_path = %req.path(),
|
||||||
user_agent = %user_agent,
|
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(),
|
request_id = %Uuid::new_v4(),
|
||||||
status_code = tracing::field::Empty,
|
status_code = tracing::field::Empty,
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user