diff --git a/CHANGELOG.md b/CHANGELOG.md index b68802b3..916b581a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ page. See [DEVELOPMENT_CYCLE.md](DEVELOPMENT_CYCLE.md) for more details. - Routed compact filter (cbf) traffic through the configured SOCKS5 proxy - Rejected `--proxy` on the `rpc` backend, and unsupported proxy options (`--proxy_auth`, `--timeout`) on the `rpc` and `cbf` backends, instead of silently ignoring them - Fixed `compile` rejecting policies that are valid for the requested script type +- Fixed `warn!` messages, including the mainnet notice, being hidden unless `RUST_LOG` was set; warnings are now shown by default ## [4.0.0] diff --git a/src/main.rs b/src/main.rs index 06e3ea24..d13bf8a9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,7 +33,7 @@ use clap::{CommandFactory, Parser}; #[tokio::main] async fn main() { - env_logger::init(); + env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("warn")).init(); let cli_opts: CliOpts = CliOpts::parse(); let network = &cli_opts.network; diff --git a/tests/integration/init.rs b/tests/integration/init.rs index 120341ab..12086ff6 100644 --- a/tests/integration/init.rs +++ b/tests/integration/init.rs @@ -120,6 +120,30 @@ mod test_wallets { .stderr(predicate::str::contains("No wallets configured yet.")); } + #[test] + fn test_mainnet_warning_shown_by_default() { + let temp_dir = TempDir::new().unwrap(); + let cli = BdkCli::new("bitcoin", Some(temp_dir.path().to_path_buf())); + + cli.cmd("wallets", &[]) + .env_remove("RUST_LOG") + .assert() + .stderr(predicate::str::contains( + "not currently recommended for use on Bitcoin mainnet", + )); + } + + #[test] + fn test_mainnet_warning_hidden_with_rust_log_error() { + let temp_dir = TempDir::new().unwrap(); + let cli = BdkCli::new("bitcoin", Some(temp_dir.path().to_path_buf())); + + cli.cmd("wallets", &[]) + .env("RUST_LOG", "error") + .assert() + .stderr(predicate::str::contains("not currently recommended").not()); + } + #[cfg(feature = "rpc")] #[test] fn test_list_wallets_with_entries() {