Struct logger::Logger
[−]
[src]
pub struct Logger {
// some fields omitted
}Middleware for logging request and response info to the terminal.
Methods
impl Logger[src]
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[src]
fn before(&self, req: &mut Request) -> IronResult<()>
Do whatever work this middleware should do with a Request object.
fn catch(&self, req: &mut Request, err: IronError) -> IronResult<()>
Respond to an error thrown by a previous BeforeMiddleware. Read more
impl AfterMiddleware for Logger[src]
fn after(&self, req: &mut Request, res: Response) -> IronResult<Response>
Do whatever post-processing this middleware should do.
fn catch(&self, req: &mut Request, err: IronError) -> IronResult<Response>
Respond to an error thrown by previous AfterMiddleware, the Handler, or a BeforeMiddleware. Read more