Merge branch 'master' of github.com:ethcore/parity into jsonrpc2

This commit is contained in:
debris 2016-02-24 10:10:49 +01:00
commit ad268d27d7
4 changed files with 15 additions and 2 deletions

1
Cargo.lock generated
View File

@ -15,6 +15,7 @@ dependencies = [
"fdlimit 0.1.0", "fdlimit 0.1.0",
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]

View File

@ -10,6 +10,7 @@ log = "0.3"
env_logger = "0.3" env_logger = "0.3"
rustc-serialize = "0.3" rustc-serialize = "0.3"
docopt = "0.6" docopt = "0.6"
time = "0.1"
ctrlc = { git = "https://github.com/tomusdrw/rust-ctrlc.git" } ctrlc = { git = "https://github.com/tomusdrw/rust-ctrlc.git" }
clippy = { version = "0.0.44", optional = true } clippy = { version = "0.0.44", optional = true }
ethcore-util = { path = "util" } ethcore-util = { path = "util" }

View File

@ -30,6 +30,7 @@ extern crate env_logger;
extern crate ctrlc; extern crate ctrlc;
extern crate fdlimit; extern crate fdlimit;
extern crate daemonize; extern crate daemonize;
extern crate time;
#[cfg(feature = "rpc")] #[cfg(feature = "rpc")]
extern crate ethcore_rpc as rpc; extern crate ethcore_rpc as rpc;
@ -38,7 +39,6 @@ use std::net::{SocketAddr};
use std::env; use std::env;
use std::process::exit; use std::process::exit;
use std::path::PathBuf; use std::path::PathBuf;
use rlog::{LogLevelFilter};
use env_logger::LogBuilder; use env_logger::LogBuilder;
use ctrlc::CtrlC; use ctrlc::CtrlC;
use util::*; use util::*;
@ -112,6 +112,8 @@ struct Args {
} }
fn setup_log(init: &Option<String>) { fn setup_log(init: &Option<String>) {
use rlog::*;
let mut builder = LogBuilder::new(); let mut builder = LogBuilder::new();
builder.filter(None, LogLevelFilter::Info); builder.filter(None, LogLevelFilter::Info);
@ -123,6 +125,15 @@ fn setup_log(init: &Option<String>) {
builder.parse(s); builder.parse(s);
} }
let format = |record: &LogRecord| {
let timestamp = time::strftime("%Y-%m-%d %H:%M:%S %Z", &time::now()).unwrap();
if max_log_level() <= LogLevelFilter::Info {
format!("{}{}", timestamp, record.args())
} else {
format!("{}{}:{}: {}", timestamp, record.level(), record.target(), record.args())
}
};
builder.format(format);
builder.init().unwrap(); builder.init().unwrap();
} }

View File

@ -500,7 +500,7 @@ impl<Message> Host<Message> where Message: Send + Sync + Clone {
match TcpStream::connect(&address) { match TcpStream::connect(&address) {
Ok(socket) => socket, Ok(socket) => socket,
Err(e) => { Err(e) => {
warn!("Can't connect to node: {:?}", e); warn!("Can't connect to address {:?}: {:?}", address, e);
return; return;
} }
} }