moadim 0.0.3

Moadim.io MCP/REST server for managing cron jobs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use axum::{extract::Request, middleware::Next, response::Response};
use std::time::Instant;

pub async fn logger(req: Request, next: Next) -> Response {
    let method = req.method().clone();
    let path = req.uri().path().to_string();
    log::info!("{} {}", method, path);
    let start = Instant::now();
    let res = next.run(req).await;
    log::info!(
        "  -> {} {} in {}ms",
        res.status(),
        path,
        start.elapsed().as_millis()
    );
    res
}