Skip to content

scripted-diff: Use LogInfo over LogPrintf#29641

Merged
fanquake merged 2 commits intobitcoin:masterfrom
maflcko:2403-log-
Dec 6, 2025
Merged

scripted-diff: Use LogInfo over LogPrintf#29641
fanquake merged 2 commits intobitcoin:masterfrom
maflcko:2403-log-

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented Mar 12, 2024

LogPrintf has many issues:

  • It does not mention the log severity (info).
  • It is a deprecated alias for LogInfo, according to the dev notes.
  • It wastes review cycles, because reviewers sometimes point out that it is deprecated.
  • It makes the code inconsistent, when both versions of the alias are used.

Fix all issues by removing the deprecated alias.

@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 12, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/29641.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK stickies-v, ajtowns, rkrux
Concept ACK sedited, l0rinc
Stale ACK kevkevinpal, fanquake

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #34018 (log: exempt all category-specific logs from ratelimiting when running with debug by stickies-v)
  • #34008 (log: don't rate-limit "new peer" with -debug=net by 0xB10C)
  • #33966 (refactor: disentangle miner startup defaults from runtime options by Sjors)
  • #33819 (mining: getCoinbase() returns struct instead of raw tx by Sjors)
  • #30343 (wallet, logging: Replace WalletLogPrintf() with LogInfo() by ryanofsky)
  • #29256 (log, refactor: Allow log macros to accept context arguments by ryanofsky)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@kevkevinpal
Copy link
Contributor

concept ACK fae5751

@kevkevinpal
Copy link
Contributor

I noticed that there are helper functions such as the following using the LogPrintf naming scheme

  • WalletLogPrintf in src/wallet/wallet.h
  • LogPrintfCategoryWithThreadNames, LogPrintfCategory, LogPrintfCategoryWithoutThreadNames, LogPrintfWithoutThreadNames, LogPrintfWithThreadNames in ./src/bench/logging.cpp

Using this grep grep -nri "\<LogPrintLevel\>" ./src --binary-files=without-match
I also noticed that we are using LogPrintLevel when we could be using LogInfo, LogWarning, LogError, LogDebug and LogTrace

these might want to be addressed in a separate PR though

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

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

ACK 317b71bcd2e552f93ac2131b16a8acab414567dd - I think the conflicts here are small, and a number are themselves draft / WIP.

@l0rinc
Copy link
Contributor

l0rinc commented Nov 25, 2025

Is this ready for review now?

@maflcko
Copy link
Member Author

maflcko commented Nov 27, 2025

Is this ready for review now?

No. Someone would have to pick up #29231, because most of the logs are alerts, and not info logs.

So i went ahead and did that in #33960

MarcoFalke added 2 commits December 4, 2025 19:52
This refactor does not change behavior.

-BEGIN VERIFY SCRIPT-

 sed --in-place 's/\<LogPrintf\>/LogInfo/g' \
   $( git grep -l '\<LogPrintf\>' -- ./contrib/ ./src/ ./test/ ':(exclude)src/logging.h' )

-END VERIFY SCRIPT-
Copy link
Contributor

@stickies-v stickies-v left a comment

Choose a reason for hiding this comment

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

ACK fa4395d

nit: would be nice to update the scripted-diff to also remove trailing newlines if that's not a huge pita

@ajtowns
Copy link
Contributor

ajtowns commented Dec 5, 2025

ACK fa4395d

Copy link
Contributor

@rkrux rkrux left a comment

Choose a reason for hiding this comment

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

lgtm ACK fa4395d

Thanks for the cleanup, best to remove the deprecated LogPrintf alias.

It wastes review cycles, because reviewers sometimes point out that it is deprecated.

I reviewed #34008 where exactly this^ happened: #34008 (comment)

@maflcko
Copy link
Member Author

maflcko commented Dec 6, 2025

nit: would be nice to update the scripted-diff to also remove trailing newlines if that's not a huge pita

Thx, I can take a look, if I have to re-touch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.