Skip to content

Commit 924d479

Browse files
committed
merge main
2 parents 99ea7e5 + eaf0c3b commit 924d479

File tree

6 files changed

+43
-21
lines changed

6 files changed

+43
-21
lines changed

Cargo.lock

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

catalyst-toolbox/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ regex = "1.5"
4545
serde = "1.0"
4646
serde_json = "1.0"
4747
structopt = "0.3"
48-
stderrlog = "0.5"
4948
serde_yaml = "0.8.17"
5049
sscanf = "0.1"
5150
color-eyre = "0.6"
@@ -60,6 +59,7 @@ symmetric-cipher = { git = "https://github.com/input-output-hk/chain-wallet-libs
6059
graphql_client = "0.10"
6160
gag = "1"
6261
vit-servicing-station-lib = { git = "https://github.com/input-output-hk/vit-servicing-station.git", branch = "master" }
62+
env_logger = "0.9"
6363

6464
[dev-dependencies]
6565
rand_chacha = "0.3"

catalyst-toolbox/src/bin/catalyst-toolbox.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use structopt::StructOpt;
33
pub mod cli;
44

55
fn main() -> color_eyre::Result<()> {
6+
env_logger::try_init()?;
67
color_eyre::install()?;
78
cli::Cli::from_args().exec()?;
89
Ok(())

catalyst-toolbox/src/bin/cli/recovery/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,18 @@ impl Recover {
1919
}
2020
}
2121
}
22+
23+
fn set_verbosity(verbosity: usize) {
24+
if verbosity > 0 {
25+
std::env::set_var(
26+
"RUST_LOG",
27+
match verbosity {
28+
0 => unreachable!(),
29+
1 => "warn",
30+
2 => "info",
31+
3 => "debug",
32+
_ => "trace",
33+
},
34+
)
35+
}
36+
}

catalyst-toolbox/src/bin/cli/recovery/tally.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ use std::path::PathBuf;
1212
use reqwest::Url;
1313
use structopt::StructOpt;
1414

15+
use super::set_verbosity;
16+
1517
/// Recover the tally from fragment log files and the initial preloaded block0 binary file.
1618
#[derive(StructOpt)]
1719
#[structopt(rename_all = "kebab")]
@@ -59,7 +61,8 @@ impl ReplayCli {
5961
output_format,
6062
verbose,
6163
} = self;
62-
stderrlog::new().verbosity(verbose).init().unwrap();
64+
65+
set_verbosity(verbose);
6366

6467
let block0 = if let Some(path) = block0_path {
6568
read_block0(path)?

catalyst-toolbox/src/bin/cli/recovery/votes.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ use std::iter::IntoIterator;
1818
use std::path::PathBuf;
1919
use structopt::StructOpt;
2020

21+
use super::set_verbosity;
22+
2123
#[derive(StructOpt)]
2224
#[structopt(rename_all = "kebab-case")]
2325
pub struct VotesPrintout {
@@ -102,7 +104,8 @@ impl VotesPrintout {
102104
verbose,
103105
} = self;
104106

105-
stderrlog::new().verbosity(verbose).init().unwrap();
107+
set_verbosity(verbose);
108+
106109
let reader = std::fs::File::open(block0_path)?;
107110
let block0 = Block::deserialize(&mut Codec::new(reader)).unwrap();
108111

0 commit comments

Comments
 (0)