aboutsummaryrefslogtreecommitdiff
path: root/test/lint
diff options
context:
space:
mode:
authorlaanwj <126646+laanwj@users.noreply.github.com>2022-06-14 11:44:09 +0200
committerlaanwj <126646+laanwj@users.noreply.github.com>2022-06-14 11:46:32 +0200
commit9e4fbebcc8e497016563e46de4c64fa094edab2d (patch)
tree4a7fb5d419b8f1e22f2b8277c79ca34868ac1bac /test/lint
parent1557014378cc5a6234a9244fa60132955206fd27 (diff)
parentecff20db286e2f5d3afe32cfaae72de69d34d23c (diff)
downloadbitcoin-9e4fbebcc8e497016563e46de4c64fa094edab2d.tar.xz
Merge bitcoin/bitcoin#25306: logging: add LogPrintfCategory to log unconditionally with category
ecff20db286e2f5d3afe32cfaae72de69d34d23c logging: use LogPrintfCategory rather than a manual category (Jon Atack) eb8aab759fb15824a5dd3004e689d0eb5b884a32 logging: add LogPrintfCategory to log unconditionally with category (Jon Atack) Pull request description: These are the next two commits from #25203. - Add `LogPrintfCategory` to log unconditionally while prefixing the output with the passed category name. Add documentation and a unit test, and update the `lint-logs.py` and `lint-format-strings.py` scripts. - Replace the log messages that manually print a category, with `LogPrintfCategory`. In upcoming commits, it will likely be used in many other cases, such as to replace `LogPrintf` where it makes sense. ACKs for top commit: klementtan: Code Review ACK ecff20db286e2f5d3afe32cfaae72de69d34d23c laanwj: Code review ACK ecff20db286e2f5d3afe32cfaae72de69d34d23c brunoerg: ACK ecff20db286e2f5d3afe32cfaae72de69d34d23c Tree-SHA512: ad3a82835254f7606efcd14b88f3d9072f1eb9b25db1321ed38ef6a4ec60efd555d78f5e19d93736f2f8500251d06f8beee9d694a153f24bf5cce3590a2a45a5
Diffstat (limited to 'test/lint')
-rwxr-xr-xtest/lint/lint-format-strings.py1
-rwxr-xr-xtest/lint/lint-logs.py4
2 files changed, 3 insertions, 2 deletions
diff --git a/test/lint/lint-format-strings.py b/test/lint/lint-format-strings.py
index 412cf86791..522023e328 100755
--- a/test/lint/lint-format-strings.py
+++ b/test/lint/lint-format-strings.py
@@ -22,6 +22,7 @@ FUNCTION_NAMES_AND_NUMBER_OF_LEADING_ARGUMENTS = [
'LogConnectFailure,1',
'LogPrint,1',
'LogPrintf,0',
+ 'LogPrintfCategory,1',
'LogPrintLevel,2',
'printf,0',
'snprintf,2',
diff --git a/test/lint/lint-logs.py b/test/lint/lint-logs.py
index de53729b4e..aaf697467d 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"(LogPrintLevel|LogPrintf?)\(", "--", "*.cpp"], universal_newlines=True, encoding="utf8").splitlines()
+ logs_list = check_output(["git", "grep", "--extended-regexp", r"(LogPrintLevel|LogPrintfCategory|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(), LogPrint(), LogPrintLevel(), and WalletLogPrintf() should be terminated with \"\\n\".")
+ print("All calls to LogPrintf(), LogPrintfCategory(), LogPrint(), LogPrintLevel(), and WalletLogPrintf() should be terminated with \"\\n\".")
print("")
for line in unterminated_logs: