Repository navigation
fix(log): show warnings by default - #353
Conversation
env_logger only shows errors when RUST_LOG is unset, so every warn!, including the mainnet notice, was hidden from users. Default the filter to warn while keeping RUST_LOG as an override, and add tests for both cases. Fixes bitcoindevkit#352
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #353 +/- ##
=======================================
Coverage 61.46% 61.46%
=======================================
Files 23 23
Lines 3989 3989
=======================================
Hits 2452 2452
Misses 1537 1537
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
vadim-anfv
left a comment
There was a problem hiding this comment.
tACK 33808be
Checked both cases on the branch: cargo run -- --network=bitcoin wallets prints the mainnet warning with no environment variable set, and RUST_LOG=error hides it again.
On the open question in the description: I would keep the global default rather than bdk_cli=warn. A warning from rustls or rusqlite is worth seeing just as much as one from bdk-cli, and narrowing it later is a one-word change if dependencies turn out to be noisy. @tvpeter how do you see this one, global or bdk-cli only?
One nit: worth a line in [Unreleased] in CHANGELOG.md, since this changes what users see on a plain run.
|
Thanks for testing, @vadim-anfv. Added the CHANGELOG entry under [Unreleased]. |
I agree that having it global might provide useful upstream warnings to users. |
Fixes #352
env_logger::init()only showserrormessages whenRUST_LOGis unset, so everywarn!in bdk-cli was hidden from users, including the mainnet notice.This PR defaults the log filter to
warnwhile keepingRUST_LOGas an override (RUST_LOG=errorhides warnings again), and adds tests for both cases. The default covers all crates as proposed in the issue; limiting it tobdk_cli=warnis a one-word change if preferred.Fixed
Warnings, including the mainnet notice, are now shown by default without setting
RUST_LOG.