Skip to content

Commit eaf0c3b

Browse files
authored
Merge pull request #138 from input-output-hk/rm-stderrlog
remove stderrlog
2 parents d69ce4d + 41b2165 commit eaf0c3b

File tree

6 files changed

+42
-22
lines changed

6 files changed

+42
-22
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
thiserror = "1.0"
@@ -59,6 +58,7 @@ symmetric-cipher = { git = "https://github.com/input-output-hk/chain-wallet-libs
5958
graphql_client = "0.10"
6059
gag = "1"
6160
vit-servicing-station-lib = { git = "https://github.com/input-output-hk/vit-servicing-station.git", branch = "master" }
61+
env_logger = "0.9"
6262

6363
[dev-dependencies]
6464
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
@@ -5,6 +5,7 @@ use structopt::StructOpt as _;
55
pub mod cli;
66

77
fn main() {
8+
env_logger::init();
89
cli::Cli::from_args().exec().unwrap_or_else(report_error)
910
}
1011

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 & 1 deletion
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 {
@@ -89,7 +91,8 @@ impl ReplayCli {
8991
output_format,
9092
verbose,
9193
} = self;
92-
stderrlog::new().verbosity(verbose).init().unwrap();
94+
95+
set_verbosity(verbose);
9396

9497
let block0 = if let Some(path) = block0_path {
9598
read_block0(path)?

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use super::tally::Error;
1+
use super::{set_verbosity, tally::Error};
22
use catalyst_toolbox::recovery::tally::{
33
deconstruct_account_transaction, ValidatedFragment, ValidationError, VoteFragmentFilter,
44
};
@@ -102,7 +102,8 @@ impl VotesPrintout {
102102
verbose,
103103
} = self;
104104

105-
stderrlog::new().verbosity(verbose).init().unwrap();
105+
set_verbosity(verbose);
106+
106107
let reader = std::fs::File::open(block0_path)?;
107108
let block0 = Block::deserialize(&mut Codec::new(reader)).unwrap();
108109

0 commit comments

Comments
 (0)