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);

Trait Implementations

impl BeforeMiddleware for Logger

fn before(&self, req: &mut Request) -> IronResult<()>

fn catch(&self, req: &mut Request, err: IronError) -> IronResult<()>

impl AfterMiddleware for Logger

fn after(&self, req: &mut Request, res: Response) -> IronResult<Response>

fn catch(&self, req: &mut Request, err: IronError) -> IronResult<Response>