Skip to main content

request_header

Function request_header 

Source
pub fn request_header(
    header_name: impl Into<HeaderName<'static>>,
) -> impl LogFormatter
Expand description

formatter-builder for a particular request header, formatted wrapped in quotes. "" if the header is not present

usage:

Logger::new().with_formatter(("user-agent: ", request_header("user-agent")));

// or

Logger::new().with_formatter((
    "user-agent: ",
    request_header(trillium::KnownHeaderName::UserAgent),
));

note: this is not a formatter itself, but returns a formatter when called with a header name