iron / iron/logger

Logger doesn't log errors

Open
#58 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
25
Forks
37
PR merge metrics
No merged PRs in 30d

Description

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:

``` rust
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 {
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();
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.