Skip to content

Conversation

@jonatack
Copy link
Member

@jonatack jonatack commented May 25, 2022

Follow-up to #24464 that added the LogPrintLevel() macro.

  • update the lint-logs.py script to detect LogPrintLevel()
  • add WalletLogPrintf() (already detected but not mentioned) to the linter suggestion

Example output:

$ test/lint/lint-logs.py 
All calls to LogPrintf(), LogPrint(), LogPrintLevel(), and WalletLogPrintf() should be terminated with "\n".

src/addrdb.cpp:147:        LogPrintf("banlist.dat ignored because it can only be read by " PACKAGE_NAME " version 22.x. Remove %s to silence this warning.", fs::quoted(fs::PathToString(m_banlist_dat)));
src/addrman.cpp:388:        LogPrint(BCLog::ADDRMAN, "addrman lost %i new and %i tried addresses due to collisions or invalid addresses", nLostUnk, nLost);
src/banman.cpp:41:        LogPrintf("Recreating the banlist database");
src/banman.cpp:66:    LogPrint(BCLog::NET, "Flushed %d banned node addresses/subnets to disk  %dms", banmap.size(),
src/banman.cpp:194:            LogPrint(BCLog::NET, "Removed banned node address/subnet: %s", sub_net.ToString());
src/net.cpp:2092:                LogPrint(BCLog::NET, "Trying to make an anchor connection to %s", addrConnect.ToString());
src/net.cpp:2408:        LogPrintLevel(BCLog::Level::Error, BCLog::NET, "%s", strError.original);
src/net.cpp:2416:        LogPrintf("%s", strError.original);
src/net.cpp:2432:            LogPrintf("%s", strError.original);
src/net.cpp:2453:        LogPrintLevel(BCLog::Level::Error, BCLog::NET, "%s", strError.original);
src/netbase.cpp:573:                LogPrintf("wait for connect to %s failed: %s",
src/netbase.cpp:578:                LogPrint(BCLog::NET, "connection attempt to %s timed out", addrConnect.ToString());
src/netbase.cpp:590:                LogPrintf("getsockopt() for %s failed: %s", addrConnect.ToString(), NetworkErrorString(WSAGetLastError()));
src/wallet/wallet.cpp:186:    wallet->WalletLogPrintf("Releasing wallet");
src/wallet/wallet.cpp:1809:        WalletLogPrintf("Rescan completed in %15dms", duration_milliseconds.count());

@DrahtBot DrahtBot added the Tests label May 25, 2022
@jonatack jonatack force-pushed the update-logs-linter-script-with-LogPrintLevel branch from 7d6f694 to 8942fa8 Compare May 26, 2022 12:41
@jonatack jonatack changed the title scripts and tools: update lint-logs.py with LogPrintLevel() scripts and tools: update lint-logs.py to detect LogPrintLevel, mention WalletLogPrintf May 26, 2022
@laanwj
Copy link
Member

laanwj commented May 26, 2022

LGTM now, this could be squashed to one commit imo.

and add WalletLogPrintf() (already detected) to the lint-logs.py suggestion

Co-authored-by: laanwj <[email protected]>
@jonatack jonatack force-pushed the update-logs-linter-script-with-LogPrintLevel branch from 8942fa8 to 75848ec Compare May 26, 2022 13:01
@jonatack
Copy link
Member Author

Yes, squashed.

@laanwj
Copy link
Member

laanwj commented May 26, 2022

ACK 75848ec

@DrahtBot
Copy link
Contributor

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #25203 (log: dedup categories, add macro, use severity-based logging for tor/i2p/netbase by jonatack)

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.

@maflcko maflcko merged commit 77e125c into bitcoin:master May 27, 2022
@jonatack jonatack deleted the update-logs-linter-script-with-LogPrintLevel branch May 27, 2022 08:10
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 28, 2022
@bitcoin bitcoin locked and limited conversation to collaborators May 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants