defensive initializing log

This commit is contained in:
debris 2016-01-29 14:19:14 +01:00
parent b5d78283bc
commit c1cf9bdcdf

View File

@ -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
};
}