diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2017-07-13 16:32:44 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2017-07-13 16:39:50 +0200 |
| commit | 3411085334a9b9b7e540d63ca36c8f4a01b52745 (patch) | |
| tree | 67996f232ecad56eeb632dec1f7451b530a97f81 | |
| parent | 814286bda8dd55c8953b3ac7271abbb525966052 (diff) | |
| download | mullvadvpn-3411085334a9b9b7e540d63ca36c8f4a01b52745.tar.xz mullvadvpn-3411085334a9b9b7e540d63ca36c8f4a01b52745.zip | |
Make argument verbosity only affect Mullvad crates
| -rw-r--r-- | mullvad_daemon/src/cli.rs | 2 | ||||
| -rw-r--r-- | mullvad_daemon/src/main.rs | 18 |
2 files changed, 16 insertions, 4 deletions
diff --git a/mullvad_daemon/src/cli.rs b/mullvad_daemon/src/cli.rs index a5fefcc782..1a2000fa47 100644 --- a/mullvad_daemon/src/cli.rs +++ b/mullvad_daemon/src/cli.rs @@ -26,7 +26,7 @@ pub fn get_config() -> Config { } fn create_app() -> App<'static, 'static> { - App::new("mullvadd") + App::new(::CRATE_NAME) .version(crate_version!()) .author(crate_authors!()) .about(crate_description!()) diff --git a/mullvad_daemon/src/main.rs b/mullvad_daemon/src/main.rs index 3736f87c7c..3aef326e49 100644 --- a/mullvad_daemon/src/main.rs +++ b/mullvad_daemon/src/main.rs @@ -72,6 +72,8 @@ lazy_static! { ]; } +static CRATE_NAME: &str = "mullvadd"; + /// All events that can happen in the daemon. Sent from various threads and exposed interfaces. pub enum DaemonEvent { @@ -473,7 +475,14 @@ fn run() -> Result<()> { } fn init_logger(log_level: log::LogLevelFilter, log_file: &Path) -> Result<()> { - fern::Dispatch::new() + let silenced_crates = [ + "jsonrpc_core", + "tokio_core", + "jsonrpc_ws_server", + "ws", + "mio", + ]; + let mut config = fern::Dispatch::new() .format(|out, message, record| { out.finish(format_args!("{}[{}][{}] {}", chrono::Local::now() @@ -482,8 +491,11 @@ fn init_logger(log_level: log::LogLevelFilter, log_file: &Path) -> Result<()> { record.level(), message)) }) - .level(log_level) - .chain(std::io::stdout()) + .level(log_level); + for silenced_crate in &silenced_crates { + config = config.level_for(*silenced_crate, log::LogLevelFilter::Warn); + } + config.chain(std::io::stdout()) .chain(fern::log_file(log_file).chain_err(|| "Failed to open log file for writing")?) .apply().chain_err(|| "Failed to bootstrap logging system") } |
