diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2017-07-13 16:20:46 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2017-07-13 16:20:46 +0200 |
| commit | 814286bda8dd55c8953b3ac7271abbb525966052 (patch) | |
| tree | 50fcb265abe3172ff26165007fd02cfbe84e3acf /mullvad_daemon/src/cli.rs | |
| parent | f5a69fb98a891107522fb9507cc3d98de5551325 (diff) | |
| download | mullvadvpn-814286bda8dd55c8953b3ac7271abbb525966052.tar.xz mullvadvpn-814286bda8dd55c8953b3ac7271abbb525966052.zip | |
Accept path to log file as argument
Diffstat (limited to 'mullvad_daemon/src/cli.rs')
| -rw-r--r-- | mullvad_daemon/src/cli.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/mullvad_daemon/src/cli.rs b/mullvad_daemon/src/cli.rs index cdc2f5fd81..a5fefcc782 100644 --- a/mullvad_daemon/src/cli.rs +++ b/mullvad_daemon/src/cli.rs @@ -1,8 +1,11 @@ use clap::{App, Arg}; use log; +use std::path::PathBuf; + pub struct Config { pub log_level: log::LogLevelFilter, + pub log_file: PathBuf, } pub fn get_config() -> Config { @@ -14,9 +17,11 @@ pub fn get_config() -> Config { 1 => log::LogLevelFilter::Debug, _ => log::LogLevelFilter::Trace, }; + let log_file = PathBuf::from(value_t_or_exit!(matches, "log_file", String)); Config { log_level, + log_file, } } @@ -29,4 +34,8 @@ fn create_app() -> App<'static, 'static> { .short("v") .multiple(true) .help("Sets the level of verbosity.")) + .arg(Arg::with_name("log_file") + .long("log") + .default_value("./mullvadd.log") + .help("Sets the path where to write the log")) } |
