Common log init function

This commit is contained in:
arkpar
2016-01-29 15:01:39 +01:00
parent 53f9bff95c
commit 3aa00586e3
3 changed files with 31 additions and 19 deletions

View File

@@ -13,24 +13,8 @@ pub enum ChainEra {
Homestead,
}
lazy_static! {
static ref LOG_DUMMY: bool = {
let mut builder = LogBuilder::new();
builder.filter(None, LogLevelFilter::Info);
if let Ok(log) = env::var("RUST_LOG") {
builder.parse(&log);
}
if let Ok(_) = builder.init() {
println!("logger initialized");
}
true
};
}
pub fn json_chain_test(json_data: &[u8], era: ChainEra) -> Vec<String> {
let _ = LOG_DUMMY.deref();
init_log();
let json = Json::from_str(::std::str::from_utf8(json_data).unwrap()).expect("Json is invalid");
let mut failed = Vec::new();