Skip to content

Commit

Permalink
Merge pull request #314 from Concordium/lma/fix/log_level_arg
Browse files Browse the repository at this point in the history
Log level filter
  • Loading branch information
lassemand authored Nov 29, 2024
2 parents f9aec3f + 0ceb863 commit 64523f2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backend-rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend-rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "concordium-scan"
version = "0.1.1"
version = "0.1.2"
edition = "2021"
description = "CCDScan: Indexer and API for the Concordium blockchain"
authors = ["Concordium <developers@concordium.com>"]
Expand Down
10 changes: 9 additions & 1 deletion backend-rust/src/bin/ccdscan-api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,21 @@ struct Cli {
metrics_listen: SocketAddr,
#[command(flatten, next_help_heading = "Configuration")]
api_config: graphql_api::ApiServiceConfig,
#[arg(
long = "log-level",
default_value = "info",
help = "The maximum log level. Possible values are: `trace`, `debug`, `info`, `warn`, and \
`error`.",
env = "LOG_LEVEL"
)]
log_level: tracing_subscriber::filter::LevelFilter,
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
let _ = dotenvy::dotenv();
let cli = Cli::parse();
tracing_subscriber::fmt().with_max_level(tracing::Level::INFO).init();
tracing_subscriber::fmt().with_max_level(cli.log_level).init();
let pool = PgPoolOptions::new()
.min_connections(cli.min_connections)
.max_connections(cli.max_connections)
Expand Down
10 changes: 9 additions & 1 deletion backend-rust/src/bin/ccdscan-indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,21 @@ struct Cli {
metrics_listen: SocketAddr,
#[command(flatten, next_help_heading = "Performance tuning")]
indexer_config: IndexerServiceConfig,
#[arg(
long = "log-level",
default_value = "info",
help = "The maximum log level. Possible values are: `trace`, `debug`, `info`, `warn`, and \
`error`.",
env = "LOG_LEVEL"
)]
log_level: tracing_subscriber::filter::LevelFilter,
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
let _ = dotenvy::dotenv();
let cli = Cli::parse();
tracing_subscriber::fmt().with_max_level(tracing::Level::INFO).init();
tracing_subscriber::fmt().with_max_level(cli.log_level).init();
let pool = PgPoolOptions::new()
.min_connections(cli.min_connections)
.max_connections(cli.max_connections)
Expand Down

0 comments on commit 64523f2

Please sign in to comment.