Skip to content

Commit

Permalink
feat: Ability to set log level via CLI argument
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsvante committed Oct 27, 2021
1 parent 1ee0494 commit 17a324e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/cli/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ pub(crate) struct Opts {
ini_path: Option<PathBuf>,
#[clap(subcommand)]
subcmd: SubCommand,
/// Set the log level
#[clap(
short = 'l',
long = "log-level",
value_name = "level",
env = "LOG_LEVEL"
)]
level_filter: Option<LevelFilter>,
}

#[derive(Debug, Parser)]
Expand Down Expand Up @@ -57,6 +65,10 @@ pub fn run() -> Result<(), Error> {

let cli_opts = Opts::parse();

if let Some(level_filter) = cli_opts.level_filter {
env_logger::builder().filter(None, level_filter).init();
}

match &cli_opts.subcmd {
SubCommand::SuiteQl {
query,
Expand Down

0 comments on commit 17a324e

Please sign in to comment.