7 releases (4 breaking)

Uses old Rust 2015

0.4.0 Dec 5, 2017
0.3.0 Jan 18, 2017
0.2.0 Nov 2, 2016
0.1.0 Jul 25, 2016
0.0.1 Dec 3, 2014

#636 in HTTP server

Download history 129/week @ 2023-06-07 338/week @ 2023-06-14 629/week @ 2023-06-21 326/week @ 2023-06-28 623/week @ 2023-07-05 271/week @ 2023-07-12 389/week @ 2023-07-19 419/week @ 2023-07-26 224/week @ 2023-08-02 377/week @ 2023-08-09 379/week @ 2023-08-16 473/week @ 2023-08-23 253/week @ 2023-08-30 543/week @ 2023-09-06 547/week @ 2023-09-13 392/week @ 2023-09-20

1,812 downloads per month
Used in fewer than 8 crates

MIT license

204 lines

logger Build Status

Morgan-inspired logging middleware for the Iron web framework.


extern crate iron;
extern crate logger;

use iron::prelude::*;
use logger::Logger;

fn main() {
    let (logger_before, logger_after) = Logger::new(None);

    let mut chain = Chain::new(no_op_handler);

    // Link logger_before as your first before middleware.

    // Link logger_after as your *last* after middleware.


fn no_op_handler(_: &mut Request) -> IronResult<Response> {


Logger is a part of Iron's core bundle.

Logger emits request and response information using standard rust log facade, formatted with default format or a custom format string.

Format strings can specify fields to be logged (ANSI terminal colors and attributes is no longer supported since #82).


If you're using a Cargo.toml to manage dependencies, just add logger to the toml:


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.


Log implementations

To actually log anything, you will need to use some log implementation that will deliver the logs to your desired location, like standard error output, a file or log collecting service. This is not responsibility of iron-logger alone. There are numerous such implementations to choose from, from simple ones that just write to standard error like env_logger, more configurable ones like simplelog to ultimate solutions like slog. You can find more on crates.io.

If you are looking for turn-key solution, just follow example from env_logger.

Get Help

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.


~123K SLoC