Skip to content

Commit

Permalink
update logger, fixes jwilm#45
Browse files Browse the repository at this point in the history
  • Loading branch information
rroohhh committed Jan 21, 2017
1 parent dc090ea commit 6eefad1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
11 changes: 6 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -13,7 +13,7 @@ hyper = { version = "0.9", default-features = false }
iron = { version = "0.4", default-features = false }
iron-hmac = { version = "0.4", features = ["hmac-rust-crypto"] }
log = "0.3"
logger = "0.1.0"
logger = "0.3.0"
persistent = "0.2"
racer = "2.0.2"
rand = "0.3"
Expand Down
9 changes: 3 additions & 6 deletions src/http/mod.rs
Expand Up @@ -62,7 +62,7 @@ impl Key for EngineProvider {
pub fn serve<E: SemanticEngine + 'static>(config: &Config, engine: E) -> Result<Server> {
use persistent::{Read, Write};
use logger::Logger;
use logger::format::Format;
use logger::Format;

let mut chain = Chain::new(router!(
post "/parse_file" => file::parse,
Expand All @@ -71,8 +71,7 @@ pub fn serve<E: SemanticEngine + 'static>(config: &Config, engine: E) -> Result<
get "/ping" => ping::pong));

// Logging middleware
let log_fmt = Format::new("{method} {uri} -> {status} ({response-time})",
Vec::new(), Vec::new());
let log_fmt = Format::new("{method} {uri} -> {status} ({response-time})");
let (log_before, log_after) = Logger::new(log_fmt);

// log_before must be first middleware in before chain
Expand Down Expand Up @@ -113,9 +112,7 @@ pub fn serve<E: SemanticEngine + 'static>(config: &Config, engine: E) -> Result<

let app = Iron::new(chain);

Ok(Server {
inner: try!(app.http((&config.addr[..], config.port)))
})
Ok(Server { inner: try!(app.http((&config.addr[..], config.port))) })
}

/// Wrapper type with information and control of the underlying HTTP server
Expand Down

0 comments on commit 6eefad1

Please sign in to comment.