Skip to content

Commit

Permalink
Log level through CI args
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandpeelen committed Nov 15, 2024
1 parent adf4f28 commit 8d439bf
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use clap::{Parser, ValueEnum};
use env_logger::Env;
use log::Level;
use regex::Regex;

use rewatch::{build, cmd, lock, watcher};
Expand Down Expand Up @@ -40,6 +42,9 @@ struct Args {
#[arg(short, long)]
no_timing: Option<bool>,

#[arg(short, long)]
log_level: Option<Level>,

/// This creates a source_dirs.json file at the root of the monorepo, which is needed when you
/// want to use Reanalyze
#[arg(short, long)]
Expand All @@ -60,10 +65,12 @@ struct Args {
}

fn main() {
env_logger::builder()
let args = Args::parse();

let log_level = args.log_level.unwrap_or(Level::Warn);
env_logger::Builder::from_env(Env::default().default_filter_or(log_level.to_string()))
.target(env_logger::fmt::Target::Stdout)
.init();
let args = Args::parse();

let command = args.command.unwrap_or(Command::Build);
let folder = args.folder.unwrap_or(".".to_string());
Expand Down

0 comments on commit 8d439bf

Please sign in to comment.