I don't know whether this is a bug in iron/logger or iron/router, but when the router has a 404 or 301 response, it returns an Err, and logger doesn't log anything. Either router should return an Ok with the 401 or 301 status, or logger should handle logging when there's an error. I'm thinking it's the latter.
Example app demonstrating this problem:
extern crate iron;
extern crate logger;
extern crate router;
use iron::prelude::*;
use iron::status;
use logger::Logger;
use router::Router;
fn handle_hello(_ : &mut Request) -> IronResult<Response> {
Ok(Response::with((status::Ok, "Hello world")))
}
fn main() {
let (logger_before, logger_after) = Logger::new(None);
let mut router = Router::new();
router.get("/hello", handle_hello);
let mut chain = Chain::new(router);
chain.link_before(logger_before);
chain.link_after(logger_after);
Iron::new(chain).http("0.0.0.0:8080").unwrap();
}
I don't know whether this is a bug in iron/logger or iron/router, but when the router has a 404 or 301 response, it returns an
Err
, and logger doesn't log anything. Either router should return anOk
with the 401 or 301 status, or logger should handle logging when there's an error. I'm thinking it's the latter.Example app demonstrating this problem: