Skip to main content

logging_middleware

Function logging_middleware 

Source
pub async fn logging_middleware(request: Request, next: Next) -> Response
Expand description

Log every incoming HTTP request with method, URI, client IP, and user-agent.

Elapsed time is logged on the response path.

§Example

let app = Router::new()
    .layer(axum::middleware::from_fn(logging_middleware));