diff options
author | MacroFake <falke.marco@gmail.com> | 2022-05-27 10:04:46 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-05-27 10:04:49 +0200 |
commit | 77e125c486d02b333ccf81da7ee36fabe6a2d484 (patch) | |
tree | 247e1a0edd93c09d7a7c18e4b598b2c666f255ae | |
parent | c5e67be03bb06a5d7885c55db1f016fbf2333fe3 (diff) | |
parent | 75848ec2daa43b648cf497c59924d389e8243320 (diff) | |
download | bitcoin-77e125c486d02b333ccf81da7ee36fabe6a2d484.tar.xz |
Merge bitcoin/bitcoin#25217: scripts and tools: update lint-logs.py to detect LogPrintLevel, mention WalletLogPrintf
75848ec2daa43b648cf497c59924d389e8243320 scripts and tools: update lint-logs.py to detect LogPrintLevel() (Jon Atack)
Pull request description:
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());
```
ACKs for top commit:
laanwj:
ACK 75848ec2daa43b648cf497c59924d389e8243320
Tree-SHA512: 78b3bc4428aaec2d198e1ff1c44b614fa2f2a228feb6303d97765136e4796171928d341c6e55a1d4e9e5a82ab099b14fee562b878dcf7bd2276f87bd9a8d323e
-rwxr-xr-x | test/lint/lint-logs.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/lint/lint-logs.py b/test/lint/lint-logs.py index e6c4c068fb..de53729b4e 100755 --- a/test/lint/lint-logs.py +++ b/test/lint/lint-logs.py @@ -16,12 +16,12 @@ from subprocess import check_output def main(): - logs_list = check_output(["git", "grep", "--extended-regexp", r"LogPrintf?\(", "--", "*.cpp"], universal_newlines=True, encoding="utf8").splitlines() + logs_list = check_output(["git", "grep", "--extended-regexp", r"(LogPrintLevel|LogPrintf?)\(", "--", "*.cpp"], universal_newlines=True, encoding="utf8").splitlines() unterminated_logs = [line for line in logs_list if not re.search(r'(\\n"|/\* Continued \*/)', line)] if unterminated_logs != []: - print("All calls to LogPrintf() and LogPrint() should be terminated with \\n") + print("All calls to LogPrintf(), LogPrint(), LogPrintLevel(), and WalletLogPrintf() should be terminated with \"\\n\".") print("") for line in unterminated_logs: |