pub fn log<W, F>(rq: &Request, output: W, f: F) -> Response
Expand description
Adds a log entry to the given writer for each request.
Writes a line to the given “writer” after processing each request.
Log line info has the format:
"{%Y-%m-%d %H:%M%S%.6f} UTC - {METHOD} {URL} - {ELAPSED_TIME} - {RESP_SATUS}"
If you would like to customize the log output or functionality (such as integrating
with the log
crate, see rouille::log_custom
)
§Example
use std::io;
use rouille::{Request, Response};
fn handle(request: &Request) -> Response {
rouille::log(request, io::stdout(), || {
Response::text("hello world")
})
}