Skip to content

Commit

Permalink
refactor(client-cli): remove slog_scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Alenar committed Oct 17, 2024
1 parent a11741b commit d5119f4
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 14 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion mithril-client-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ slog = { version = "2.7.0", features = [
] }
slog-async = "2.8.0"
slog-bunyan = "2.5.0"
slog-scope = "4.4.0"
slog-term = "2.9.1"
thiserror = "1.0.64"
tokio = { version = "1.40.0", features = ["full"] }
Expand Down
1 change: 1 addition & 0 deletions mithril-client-cli/src/commands/cardano_db/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ impl CardanoDbDownloadCommand {
progress_output_type,
logger.clone(),
)))
.with_logger(logger.clone())
.build()?;

let get_list_of_artifact_ids = || async {
Expand Down
4 changes: 3 additions & 1 deletion mithril-client-cli/src/commands/cardano_db/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ impl CardanoDbListCommand {
/// Main command execution
pub async fn execute(&self, context: CommandContext) -> MithrilResult<()> {
let params = context.config_parameters()?;
let client = client_builder_with_fallback_genesis_key(&params)?.build()?;
let client = client_builder_with_fallback_genesis_key(&params)?
.with_logger(context.logger().clone())
.build()?;
let items = client.snapshot().list().await?;

if self.is_json_output_enabled() {
Expand Down
4 changes: 3 additions & 1 deletion mithril-client-cli/src/commands/cardano_db/show.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ impl CardanoDbShowCommand {
/// Cardano DB Show command
pub async fn execute(&self, context: CommandContext) -> MithrilResult<()> {
let params = context.config_parameters()?;
let client = client_builder_with_fallback_genesis_key(&params)?.build()?;
let client = client_builder_with_fallback_genesis_key(&params)?
.with_logger(context.logger().clone())
.build()?;

let get_list_of_artifact_ids = || async {
let cardano_dbs = client.snapshot().list().await.with_context(|| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ impl CardanoStakeDistributionDownloadCommand {
progress_output_type,
logger.clone(),
)))
.with_logger(logger.clone())
.build()?;

progress_printer.report_step(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ impl CardanoStakeDistributionListCommand {
/// Main command execution
pub async fn execute(&self, context: CommandContext) -> MithrilResult<()> {
let params = context.config_parameters()?;
let client = client_builder_with_fallback_genesis_key(&params)?.build()?;
let client = client_builder_with_fallback_genesis_key(&params)?
.with_logger(context.logger().clone())
.build()?;
let lines = client.cardano_stake_distribution().list().await?;

if self.is_json_output_enabled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ impl CardanoTransactionsCertifyCommand {
progress_output_type,
logger.clone(),
)))
.with_logger(logger.clone())
.build()?;

progress_printer.report_step(1, "Fetching a proof for the given transactions…")?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ impl CardanoTransactionSnapshotListCommand {
/// Main command execution
pub async fn execute(&self, context: CommandContext) -> MithrilResult<()> {
let params = context.config_parameters()?;
let client = client_builder_with_fallback_genesis_key(&params)?.build()?;
let client = client_builder_with_fallback_genesis_key(&params)?
.with_logger(context.logger().clone())
.build()?;
let lines = client.cardano_transaction().list_snapshots().await?;

if self.is_json_output_enabled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ impl CardanoTransactionsSnapshotShowCommand {
/// Cardano transaction snapshot Show command
pub async fn execute(&self, context: CommandContext) -> MithrilResult<()> {
let params = context.config_parameters()?;
let client = client_builder_with_fallback_genesis_key(&params)?.build()?;
let client = client_builder_with_fallback_genesis_key(&params)?
.with_logger(context.logger().clone())
.build()?;

let get_list_of_artifact_ids = || async {
let transactions_sets = client.cardano_transaction().list_snapshots().await.with_context(|| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ impl MithrilStakeDistributionDownloadCommand {
progress_output_type,
logger.clone(),
)))
.with_logger(logger.clone())
.build()?;

let get_list_of_artifact_ids = || async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ impl MithrilStakeDistributionListCommand {
/// Main command execution
pub async fn execute(&self, context: CommandContext) -> MithrilResult<()> {
let params = context.config_parameters()?;
let client = client_builder_with_fallback_genesis_key(&params)?.build()?;
let client = client_builder_with_fallback_genesis_key(&params)?
.with_logger(context.logger().clone())
.build()?;
let lines = client.mithril_stake_distribution().list().await?;

if self.is_json_output_enabled() {
Expand Down
7 changes: 2 additions & 5 deletions mithril-client-cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pub use deprecation::{DeprecatedCommand, Deprecation};

use clap::Args;
use mithril_client::{ClientBuilder, MithrilResult};
use slog_scope::logger;

use crate::configuration::ConfigParameters;

Expand All @@ -29,8 +28,7 @@ pub(crate) fn client_builder(params: &ConfigParameters) -> MithrilResult<ClientB
let builder = ClientBuilder::aggregator(
&params.require("aggregator_endpoint")?,
&params.require("genesis_verification_key")?,
)
.with_logger(logger());
);

Ok(builder)
}
Expand All @@ -50,8 +48,7 @@ pub(crate) fn client_builder_with_fallback_genesis_key(
"genesis_verification_key",
fallback_genesis_verification_key,
),
)
.with_logger(logger());
);

Ok(builder)
}
1 change: 0 additions & 1 deletion mithril-client-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ async fn main() -> MithrilResult<()> {
)
});
let logger = args.build_logger()?;
let _guard = slog_scope::set_global_logger(logger.clone());

#[cfg(feature = "bundle_openssl")]
openssl_probe::init_ssl_cert_env_vars();
Expand Down

0 comments on commit d5119f4

Please sign in to comment.