13 lines
356 B
Rust
13 lines
356 B
Rust
|
use std::net::IpAddr;
|
||
|
use axum::http::{Method, Uri};
|
||
|
|
||
|
pub async fn log(ip: &IpAddr, method: &Method, uri: &Uri, path: Option<&str>, body: Option<&str>) {
|
||
|
|
||
|
if path.is_some() && body.is_some() {
|
||
|
println!("{} {} {}{} {}", ip, method, path.unwrap(), uri, body.unwrap());
|
||
|
} else {
|
||
|
println!("{} {} {}", ip, method, uri);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|