Skip to content

Commit

Permalink
Lower default log with new verbose argument
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienGllmt committed Apr 28, 2024
1 parent 7c6c388 commit 2eaece0
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions indexer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ pub struct Cli {
/// path to config file
#[clap(long, value_parser)]
config_path: Option<PathBuf>,

/// path to config file
#[clap(short, long, action = clap::ArgAction::SetTrue)]
verbose: bool,
}

#[derive(Debug, Clone, Deserialize)]
Expand Down Expand Up @@ -75,6 +79,18 @@ pub struct Config {
#[allow(unreachable_patterns)]
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let Cli {
plan,
config_path,
verbose,
} = Cli::parse();

let default_trace = if verbose {
tracing::Level::DEBUG
} else {
tracing::Level::INFO
};

// Start logging setup block
let fmt_layer = tracing_subscriber::fmt::layer().with_test_writer();

Expand All @@ -83,7 +99,7 @@ async fn main() -> anyhow::Result<()> {
.with_target("sqlx", tracing::Level::WARN)
.with_target("oura", tracing::Level::WARN)
.with_target("sled", tracing::Level::INFO)
.with_target("carp", tracing::Level::TRACE)
.with_target("carp", default_trace)
.with_target("cardano-net", tracing::Level::INFO)
.with_target("cardano-sdk", tracing::Level::INFO)
.with_target("dcspark-blockchain-source", tracing::Level::INFO)
Expand All @@ -109,8 +125,6 @@ async fn main() -> anyhow::Result<()> {

tracing::info!("{}", "Starting Carp");

let Cli { plan, config_path } = Cli::parse();

tracing::info!("Execution plan {}", plan);
let exec_plan = Arc::new(ExecutionPlan::load_from_file(&plan)?);

Expand Down

0 comments on commit 2eaece0

Please sign in to comment.