Implement log_level config option

This commit is contained in:
Daniel García
2019-03-25 14:12:41 +01:00
parent c384f9c0ca
commit 2475c36a75
3 changed files with 10 additions and 1 deletions

View File

@ -69,6 +69,7 @@ fn launch_info() {
}
fn init_logging() -> Result<(), fern::InitError> {
use std::str::FromStr;
let mut logger = fern::Dispatch::new()
.format(|out, message, record| {
out.finish(format_args!(
@ -79,7 +80,7 @@ fn init_logging() -> Result<(), fern::InitError> {
message
))
})
.level(log::LevelFilter::Info)
.level(log::LevelFilter::from_str(&CONFIG.log_level()).expect("Valid log level"))
// Hide unknown certificate errors if using self-signed
.level_for("rustls::session", log::LevelFilter::Off)
// Hide failed to close stream messages