Struct logger::Logger
[−]
[src]
pub struct Logger { // some fields omitted }
Middleware
for logging request and response info to the terminal.
Methods
impl Logger
fn new(format: Option<Format>) -> (Logger, Logger)
Create a pair of Logger
middlewares with the specified format
. If a None
is passed in, uses the default format:
{method} {uri} -> {status} ({response_time} ms)
While the returned value can be passed straight to Chain::link
, consider making the logger BeforeMiddleware
the first in your chain and the logger AfterMiddleware
the last by doing something like this:
let mut chain = Chain::new(handler); let (logger_before, logger_after) = Logger::new(None); chain.link_before(logger_before); // link other middlewares here... chain.link_after(logger_after);