From: Ian Jackson Date: Wed, 4 Aug 2021 00:59:32 +0000 (+0100) Subject: debug flag X-Git-Tag: hippotat/1.0.0~352 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=448a7fae8e0ce1c23e186848efd96c7db8f0ed22;p=hippotat.git debug flag Signed-off-by: Ian Jackson --- diff --git a/src/bin/client.rs b/src/bin/client.rs index 12a3284..d959312 100644 --- a/src/bin/client.rs +++ b/src/bin/client.rs @@ -7,6 +7,10 @@ use hippotat_macros::into_crlfs; #[derive(StructOpt,Debug)] pub struct Opts { + /// Increase debug level + #[structopt(long, short="D", parse(from_occurrences))] + debug: usize, + #[structopt(flatten)] config: config::Opts, } @@ -297,7 +301,13 @@ async fn main() -> Result<(), AE> { .write_style("HIPPOTAT_LOG_STYLE"); let mut logb = env_logger::Builder::new(); - logb.filter(Some("hippotat"), log::LevelFilter::Info); + logb.filter(Some("hippotat"), + *[ log::LevelFilter::Info, + log::LevelFilter::Debug ] + .get(opts.debug) + .unwrap_or( + &log::LevelFilter::Trace + )); logb.parse_env(env); logb.init(); }