Merge pull request #5892 from nuttycom/fix/hide_wallet_tool_logging_init_error
Default to error logging if we cannot parse the log filter
This commit is contained in:
commit
f8062d3995
|
@ -133,9 +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::from_default_env())
|
||||
.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