1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use ;
use Instant;
use info;
/// Middleware that logs incoming requests with method, path, status, and latency.
///
/// This middleware wraps the request handler and logs:
/// - HTTP method (GET, POST, etc.)
/// - Request path
/// - Response status code
/// - Request latency in milliseconds
///
/// # Examples
///
/// ```text
/// GET /api/users 200 15ms
/// POST /api/users 201 42ms
/// GET /api/users/123 404 3ms
/// ```
///
/// # Usage
///
/// This middleware is automatically applied to all routes when using
/// [`APIApp::run`](crate::APIApp::run).
///
/// # Arguments
///
/// * `req` - The incoming HTTP request
/// * `next` - The next middleware/handler in the chain
///
/// # Returns
///
/// The HTTP response from the handler
pub async