Morgan-inspired logging middleware for the Iron web framework.
```rust extern crate iron; extern crate logger;
use iron::prelude::*; use logger::Logger;
fn main() { let (loggerbefore, loggerafter) = Logger::new(None);
let mut chain = Chain::new(no_op_handler);
// Link logger_before as your first before middleware.
chain.link_before(logger_before);
// Link logger_after as your *last* after middleware.
chain.link_after(logger_after);
Iron::new(chain).http("127.0.0.1:3000").unwrap();
}
fn noophandler(_: &mut Request) -> IronResult
Logger is a part of Iron's core bundle.
If you're using a Cargo.toml
to manage dependencies, just add logger to the toml:
```toml [dependencies.logger]
git = "https://github.com/iron/logger.git" ```
Otherwise, cargo build
, and the rlib will be in your target
directory.
Along with the online documentation,
you can build a local copy with make doc
.
One of us (@reem, @zzmp,
@theptrk, @mcreinhard)
is usually on #iron
on the mozilla irc. Come say hi and ask any questions you might have.
We are also usually on #rust
and #rust-webdev
.