mirror of https://github.com/dswd/vpncloud.git
--quiet
This commit is contained in:
parent
e4c773f10a
commit
b4fdf89b32
|
@ -45,6 +45,7 @@ Options:
|
||||||
--peer-timeout <peer_timeout> Peer timeout in seconds [default: 300]
|
--peer-timeout <peer_timeout> Peer timeout in seconds [default: 300]
|
||||||
--mac-timeout <mac_timeout> Mac table entry timeout in seconds [default: 60]
|
--mac-timeout <mac_timeout> Mac table entry timeout in seconds [default: 60]
|
||||||
-v, --verbose Log verbosely
|
-v, --verbose Log verbosely
|
||||||
|
-q, --quiet Only print error messages
|
||||||
";
|
";
|
||||||
|
|
||||||
#[derive(RustcDecodable, Debug)]
|
#[derive(RustcDecodable, Debug)]
|
||||||
|
@ -55,14 +56,18 @@ struct Args {
|
||||||
flag_connect: Vec<String>,
|
flag_connect: Vec<String>,
|
||||||
flag_peer_timeout: usize,
|
flag_peer_timeout: usize,
|
||||||
flag_mac_timeout: usize,
|
flag_mac_timeout: usize,
|
||||||
flag_verbose: bool
|
flag_verbose: bool,
|
||||||
|
flag_quiet: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args: Args = Docopt::new(USAGE).and_then(|d| d.decode()).unwrap_or_else(|e| e.exit());
|
let args: Args = Docopt::new(USAGE).and_then(|d| d.decode()).unwrap_or_else(|e| e.exit());
|
||||||
log::set_logger(|max_log_level| {
|
log::set_logger(|max_log_level| {
|
||||||
|
assert!(!args.flag_verbose || !args.flag_quiet);
|
||||||
if args.flag_verbose {
|
if args.flag_verbose {
|
||||||
max_log_level.set(log::LogLevelFilter::Debug);
|
max_log_level.set(log::LogLevelFilter::Debug);
|
||||||
|
} else if args.flag_quiet {
|
||||||
|
max_log_level.set(log::LogLevelFilter::Error);
|
||||||
} else {
|
} else {
|
||||||
max_log_level.set(log::LogLevelFilter::Info);
|
max_log_level.set(log::LogLevelFilter::Info);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue