From c1cf9bdcdfa012164e1164d5836a1e418a908973 Mon Sep 17 00:00:00 2001 From: debris Date: Fri, 29 Jan 2016 14:19:14 +0100 Subject: [PATCH] defensive initializing log --- src/tests/chain.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/tests/chain.rs b/src/tests/chain.rs index e260deddc..d56d99491 100644 --- a/src/tests/chain.rs +++ b/src/tests/chain.rs @@ -18,11 +18,13 @@ lazy_static! { let mut builder = LogBuilder::new(); builder.filter(None, LogLevelFilter::Info); - if env::var("RUST_LOG").is_ok() { - builder.parse(&env::var("RUST_LOG").unwrap()); + if let Ok(log) = env::var("RUST_LOG") { + builder.parse(&log); } - builder.init().unwrap(); + if let Ok(_) = builder.init() { + println!("logger initialized"); + } true }; }