Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripted-diff: Use LogInfo/LogDebug over LogPrintf/LogPrint #29641

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Mar 12, 2024

LogPrintf/LogPrint are problematic, because:

  • Their name is non-descriptive of what the function does (info logging or debug logging).
  • They are deprecated aliases, where code is using either the deprecated or non-deprecated alias, which is inconsistent and confusing.

Fix all issues by replacing the usage.

While the diff is large and may cause merge conflicts or backport conflicts, I don't see the deprecated aliases being kept forever, so this will have to be done at some point. All conflicts should be trivial to solve, in any case.

@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

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
Stale ACK kevkevinpal

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #30141 (kernel: De-globalize validation caches by TheCharlatan)
  • #30132 (indexes: Don't wipe indexes again when continuing a prior reindex by TheCharlatan)
  • #30126 (Low-level cluster linearization code by sipa)
  • #30110 (refactor: TxDownloadManager by glozow)
  • #30064 (net: log connections failures via SOCKS5 with less severity by vasild)
  • #30058 (Encapsulate warnings in generalized node::Warnings and remove globals by stickies-v)
  • #30043 (net: Replace libnatpmp with built-in PCP implementation by laanwj)
  • #29833 (i2p: fix and improve logs by brunoerg)
  • #29790 ([DO NOT MERGE] cmake: Migrate CI scripts to CMake-based build system -- WIP by hebasto)
  • #29702 (fees: Remove CLIENT_VERSION serialization by maflcko)
  • #29656 (chainparams: Change nChainTx type to uint64_t by fjahr)
  • #29625 (Several randomness improvements by sipa)
  • #29612 (rpc: Optimize serialization and enhance metadata of dumptxoutset output by fjahr)
  • #29605 (net: Favor peers from addrman over fetching seednodes by sr-gi)
  • #29480 (Drop log category in SeedStartup by hebasto)
  • #29418 (rpc: provide per message stats for global traffic via new RPC 'getnetmsgstats' by vasild)
  • #29415 (Broadcast own transactions only via short-lived Tor or I2P connections by vasild)
  • #29256 (Improve new LogDebug/Trace/Info/Warning/Error Macros by ryanofsky)
  • #29141 (Bugfix: RPC: Check for blank rpcauth on a per-param basis by luke-jr)
  • #28984 (Cluster size 2 package rbf by instagibbs)
  • #28830 ([refactor] Check CTxMemPool options in ctor by TheCharlatan)
  • #28792 (Embedding ASMap files as binary dump header file by fjahr)
  • #28521 (net: additional disconnect logging by Sjors)
  • #28167 (init: Add option for rpccookie permissions (replace 26088) by willcl-ark)
  • #27826 (validation: log which peer sent us a header by Sjors)
  • #27432 (contrib: add tool to convert compact-serialized UTXO set to SQLite database by theStack)
  • #27052 (test: rpc: add last block announcement time to getpeerinfo result by LarryRuane)
  • #26114 (net: Make AddrFetch connections to fixed seeds by mzumsande)
  • #25832 (tracing: network connection tracepoints by 0xB10C)
  • #19463 (Prune locks by luke-jr)

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

@DrahtBot
Copy link
Contributor

🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the
documentation.

Possibly this is due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.

Leave a comment here, if you need help tracking down a confusing failure.

Debug: https://github.com/bitcoin/bitcoin/runs/25181673072

MarcoFalke added 2 commits May 22, 2024 10:37
-BEGIN VERIFY SCRIPT-
 sed -i 's/\<LogPrintf\>/LogInfo/g' $( git grep -l '\<LogPrintf\>' -- ./contrib/ ./src/ ./test/ ':(exclude)src/logging.h' )
 sed -i 's/\<LogPrint\>/LogDebug/g' $( git grep -l '\<LogPrint\>'  -- ./contrib/ ./src/ ./test/ ':(exclude)src/logging.h' )
-END VERIFY SCRIPT-
@DrahtBot
Copy link
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

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.

None yet

5 participants