Skip to content

Commit 652c44a

Browse files
committed
implement verbosity
1 parent d0c913f commit 652c44a

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

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

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

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ use std::path::PathBuf;
1414
use reqwest::Url;
1515
use structopt::StructOpt;
1616

17+
use super::set_verbosity;
18+
1719
#[allow(clippy::large_enum_variant)]
1820
#[derive(thiserror::Error, Debug)]
1921
pub enum Error {
@@ -90,6 +92,8 @@ impl ReplayCli {
9092
verbose,
9193
} = self;
9294

95+
set_verbosity(verbose);
96+
9397
let block0 = if let Some(path) = block0_path {
9498
read_block0(path)?
9599
} else if let Some(url) = block0_url {

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,7 @@ impl VotesPrintout {
102102
verbose,
103103
} = self;
104104

105-
if verbose > 0 {
106-
std::env::set_var(
107-
"RUST_LOG",
108-
match verbose {
109-
0 => unreachable!(),
110-
1 => "warn",
111-
2 => "info",
112-
3 => "debug",
113-
_ => "trace",
114-
},
115-
)
116-
}
105+
set_verbosity(verbose);
117106

118107
let reader = std::fs::File::open(block0_path)?;
119108
let block0 = Block::deserialize(&mut Codec::new(reader)).unwrap();

0 commit comments

Comments
 (0)