Added a pretty printer and changed request log level to debug
This commit is contained in:
parent
3ecdb8c1d9
commit
33fe6534cb
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -183,7 +183,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "actix-web-utils"
|
name = "actix-web-utils"
|
||||||
version = "0.1.6"
|
version = "0.1.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-web-utils"
|
name = "actix-web-utils"
|
||||||
version = "0.1.6"
|
version = "0.1.7"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Franklin E. Blanco"]
|
authors = ["Franklin E. Blanco"]
|
||||||
description = "Just some useful addons for actix web."
|
description = "Just some useful addons for actix web."
|
||||||
|
@ -9,6 +9,7 @@ use actix_web::{
|
|||||||
Error, HttpMessage,
|
Error, HttpMessage,
|
||||||
};
|
};
|
||||||
use futures_util::{future::LocalBoxFuture, stream::StreamExt};
|
use futures_util::{future::LocalBoxFuture, stream::StreamExt};
|
||||||
|
use log::debug;
|
||||||
|
|
||||||
/// Pass this struct to App::new().wrap(HERE) to log the request body each time a request is made. Stole it from here: <https://github.com/actix/examples/blob/master/middleware/middleware/src/read_request_body.rs>
|
/// Pass this struct to App::new().wrap(HERE) to log the request body each time a request is made. Stole it from here: <https://github.com/actix/examples/blob/master/middleware/middleware/src/read_request_body.rs>
|
||||||
pub struct Logging;
|
pub struct Logging;
|
||||||
@ -59,7 +60,7 @@ where
|
|||||||
body.extend_from_slice(&chunk?);
|
body.extend_from_slice(&chunk?);
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("request body: {body:?}");
|
debug!("Incoming Request body: {:#?}", body);
|
||||||
let res = svc.call(req).await?;
|
let res = svc.call(req).await?;
|
||||||
|
|
||||||
println!("response: {:?}", res.headers());
|
println!("response: {:?}", res.headers());
|
||||||
|
Loading…
Reference in New Issue
Block a user