Struct logger::Logger [] [src]

pub struct Logger { /* fields omitted */ }

Middleware for logging request and response info to the terminal.

Methods

impl Logger
[src]

[src]

Create a pair of Logger middlewares with the specified format. If a None is passed in, uses the default format:

Be careful when using this code, it's not being tested!
{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:

Be careful when using this code, it's not being tested!
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]

[src]

Do whatever work this middleware should do with a Request object.

[src]

Respond to an error thrown by a previous BeforeMiddleware. Read more

impl AfterMiddleware for Logger
[src]

[src]

Do whatever post-processing this middleware should do.

[src]

Respond to an error thrown by previous AfterMiddleware, the Handler, or a BeforeMiddleware. Read more