zcashd-wallet-tool: improve the error message for an invalid logging filter directive.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
195bb75502
commit
fbc191a2e1
|
@ -133,11 +133,16 @@ enum WalletToolError {
|
|||
|
||||
pub fn main() {
|
||||
// Log to stderr, configured by the RUST_LOG environment variable.
|
||||
let directive = env::var("RUST_LOG").unwrap_or_else(|_| "".to_string());
|
||||
fmt()
|
||||
.with_writer(io::stderr)
|
||||
.with_env_filter(
|
||||
EnvFilter::try_from_default_env().unwrap_or_else(|err| EnvFilter::new("error")),
|
||||
)
|
||||
.with_env_filter(EnvFilter::try_new(&directive).unwrap_or_else(|_| {
|
||||
eprintln!(
|
||||
"Warning: could not parse filter directive '{}'\nfrom the RUST_LOG environment variable; using 'error' instead.\n",
|
||||
&directive
|
||||
);
|
||||
EnvFilter::new("error")
|
||||
}))
|
||||
.init();
|
||||
|
||||
// Allow either Bitcoin-style or GNU-style arguments.
|
||||
|
|
Loading…
Reference in New Issue