Parse loglevel from environment variable
This commit is contained in:
parent
709eff63e0
commit
109a9131f0
@ -19,7 +19,12 @@ fn init_logger () {
|
|||||||
builder.format(|record: &log::LogRecord| {
|
builder.format(|record: &log::LogRecord| {
|
||||||
let t = time::now();
|
let t = time::now();
|
||||||
format!("{} {}:{}: {}", time::strftime("%Y-%m-%d %H:%M:%S", &t).unwrap(), record.level(), record.location().module_path(), record.args())
|
format!("{} {}:{}: {}", time::strftime("%Y-%m-%d %H:%M:%S", &t).unwrap(), record.level(), record.location().module_path(), record.args())
|
||||||
}).filter(None, log::LogLevelFilter::Info);
|
}).filter(None, log::LogLevelFilter::Info);;
|
||||||
|
|
||||||
|
if env::var("RUST_LOG").is_ok() {
|
||||||
|
builder.parse(&env::var("RUST_LOG").unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
builder.init().unwrap();
|
builder.init().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user