calendar/src/middleware.rs
pavel 6f55ad839c
All checks were successful
/ upload (release) Successful in 1m3s
idk
2026-02-16 23:58:08 +01:00

20 lines
551 B
Rust

use axum::{body::Body, extract::Request, middleware::Next, response::Response};
use tracing::error;
pub async fn log_errors(req: Request<Body>, next: Next) -> Response {
let method = req.method().clone();
let uri = req.uri().clone();
let response = next.run(req).await;
if response.status().is_client_error() || response.status().is_server_error() {
error!(
method = ?method,
uri = ?uri,
status = ?response.status(),
"Error response returned"
);
}
response
}