linkrs-server 0.1.0

Linkrs network service layer (HTTP/gRPC)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use axum::{extract::Request, middleware::Next, response::Response};
use log::error;

pub async fn error_handling_middleware(request: Request, next: Next) -> Response {
    let path = request.uri().path().to_string();
    let method = request.method().to_string();

    let response = next.run(request).await;

    let status = response.status();
    if status.is_server_error() {
        error!("{} {} returned {}", method, path, status);
    }

    response
}