Function rouille::log [] [src]

pub fn log<W, F>(rq: &Request, output: W, f: F) -> Response where W: Write, F: FnOnce() -> Response

Adds a log entry to the given writer at each request.

Each request writes a line to the given parameter. The line contains various info like the URL of the request, the time taken, and the status code of the response.

Example

use std::io;
use rouille::{Request, Response};

fn handle(request: &Request) -> Response {
    rouille::log(request, io::stdout(), || {
        Response::text("hello world")
    })
}