Log errors
This commit is contained in:
parent
c269c55cab
commit
68e356811a
10
src/lib.rs
10
src/lib.rs
|
@ -1,5 +1,4 @@
|
||||||
#![feature(const_trait_impl)]
|
#![feature(const_trait_impl)]
|
||||||
#![feature(const_fn_trait_bound)]
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate tracing;
|
extern crate tracing;
|
||||||
|
@ -189,7 +188,14 @@ impl LogMiddleware {
|
||||||
async move {
|
async move {
|
||||||
let res = next.run(req).await;
|
let res = next.run(req).await;
|
||||||
let status = res.status();
|
let status = res.status();
|
||||||
debug!(status = %status, "Response");
|
match res.error() {
|
||||||
|
Some(e) => {
|
||||||
|
error!("Response with internal error: {e}");
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
debug!(status = %status, "Response");
|
||||||
|
}
|
||||||
|
}
|
||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
.instrument(span)
|
.instrument(span)
|
||||||
|
|
Loading…
Reference in New Issue