Skip to content

fix(log): show warnings by default - #353

Merged
tvpeter merged 2 commits into
bitcoindevkit:masterfrom
chukwudiikeh:fix/log-warnings-by-default
Oct 19, 2026
Merged

tvpeter merged 2 commits into
bitcoindevkit:masterfrom
chukwudiikeh:fix/log-warnings-by-default

Conversation

@chukwudiikeh

Copy link
Copy Markdown
Contributor

Fixes #352

env_logger::init() only shows error messages when RUST_LOG is unset, so every warn! in bdk-cli was hidden from users, including the mainnet notice.

This PR defaults the log filter to warn while keeping RUST_LOG as an override (RUST_LOG=error hides warnings again), and adds tests for both cases. The default covers all crates as proposed in the issue; limiting it to bdk_cli=warn is a one-word change if preferred.

Fixed

Warnings, including the mainnet notice, are now shown by default without setting RUST_LOG.

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

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.46%. Comparing base (79b2b83) to head (3f6b023).
⚠️ Report is 1 commits behind head on master.

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           
Flag Coverage Δ
rust 61.46% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vadim-anfv vadim-anfv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@chukwudiikeh

Copy link
Copy Markdown
Contributor Author

Thanks for testing, @vadim-anfv. Added the CHANGELOG entry under [Unreleased].

@vadim-anfv vadim-anfv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 3f6b023

@tvpeter

tvpeter commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

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?

I agree that having it global might provide useful upstream warnings to users.

@tvpeter tvpeter left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 3f6b023

@tvpeter tvpeter added this to the CLI 4.1.0 milestone Oct 19, 2026
@tvpeter
tvpeter merged commit 479ffc5 into bitcoindevkit:master Oct 19, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in BDK-CLI Oct 19, 2026
@vadim-anfv vadim-anfv mentioned this pull request Oct 19, 2026
5 of 6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

warn! output is invisible unless RUST_LOG is set

3 participants