Function warp::filters::log::custom

source ·
pub fn custom<F>(func: F) -> Log<F>
where F: Fn(Info<'_>),
Expand description

Create a wrapping Filter that receives warp::log::Info.

§Example

use warp::Filter;

let log = warp::log::custom(|info| {
    // Use a log macro, or slog, or println, or whatever!
    eprintln!(
        "{} {} {}",
        info.method(),
        info.path(),
        info.status(),
    );
});
let route = warp::any()
    .map(warp::reply)
    .with(log);