File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22mod robot;
33
44use clap:: { Parser , Subcommand } ;
5- use log:: debug;
5+ use log:: { LevelFilter , debug} ;
66use std:: fs:: File ;
77use std:: io:: Write ;
88use std:: path:: PathBuf ;
@@ -11,6 +11,9 @@ use std::path::PathBuf;
1111#[ command( version) ]
1212/// Checkmk synthetic monitoring command-line tool
1313struct Cli {
14+ #[ arg( short, long) ]
15+ verbose : bool ,
16+
1417 #[ command( subcommand) ]
1518 command : Command ,
1619}
@@ -27,9 +30,16 @@ enum Command {
2730}
2831
2932fn main ( ) {
30- env_logger:: init ( ) ;
31- let _ = create_mambarc ( ) ;
3233 let cli = Cli :: parse ( ) ;
34+
35+ // Set up logging
36+ let default_verbosity = if cli. verbose { LevelFilter :: Debug } else { LevelFilter :: Error } ;
37+ let mut env_logger_builder = env_logger:: Builder :: new ( ) ;
38+ env_logger_builder. filter_level ( default_verbosity) ;
39+ env_logger_builder. parse_default_env ( ) ;
40+ env_logger_builder. init ( ) ;
41+
42+ let _ = create_mambarc ( ) ;
3343 match cli. command {
3444 Command :: Env ( sub) => env:: run ( sub) ,
3545 Command :: Robot ( sub) => robot:: run ( sub) ,
@@ -42,8 +52,8 @@ fn create_mambarc() -> std::io::Result<()> {
4252changeps1: True
4353
4454# proxy_servers:
45- # http: http://user:pass@corp.com:8080_
46- # https: https://user:pass@corp.com:8080_
55+ # http: http://user:pass@corp.com:8080
56+ # https: https://user:pass@corp.com:8080
4757
4858# Use this only if you are behind a proxy that does SSL inspection
4959# ssl_verify: false
You can’t perform that action at this time.
0 commit comments