use poem::{Endpoint, IntoResponse, Request, Response, Result}; pub async fn logger(next: E, req: Request) -> Result { println!("request: {}", req.uri().path()); let res = next.call(req).await; match res { Ok(resp) => { let resp = resp.into_response(); println!("response: {}", resp.status()); Ok(resp) } Err(err) => { println!("error: {err}"); Err(err) } } }