What changed, and why it matters
This commit is a routine code cleanup. It removes the old `LogPrintf` logging macro, which was already marked as deprecated and was simply an alias for the newer `LogInfo`. The change updates documentation and a test case to match. There is no security issue here.
No action needed. This is a benign refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit deletes the #define LogPrintf(...) LogInfo(__VA_ARGS__) macro from src/logging.h, removes the corresponding note from doc/developer-notes.md, and updates src/test/logging_tests.cpp to stop testing the deprecated alias. This is a pure refactoring with no functional or security behavior change.
Changed components
src/logging.hdoc/developer-notes.mdsrc/test/logging_tests.cppInspect captured patch +2 / −8
diff --git a/doc/developer-notes.md b/doc/developer-notes.md
index 106533b7..d17f8024 100644
--- a/doc/developer-notes.md
+++ b/doc/developer-notes.md
@@ -752,8 +752,7 @@ logging messages. They should be used as follows:
messages or for infrequent and important events such as a new block tip
being found or a new outbound connection being made. These log messages
are unconditional, so care must be taken that they can't be used by an
- attacker to fill up storage. Note that `LogPrintf(fmt, params...)` is
- a deprecated alias for `LogInfo`.
+ attacker to fill up storage.
- `LogError(fmt, params...)` should be used in place of `LogInfo` for
severe problems that require the node (or a subsystem) to shut down
diff --git a/src/logging.h b/src/logging.h
index defff61d..4a6f1d16 100644
--- a/src/logging.h
+++ b/src/logging.h
@@ -369,9 +369,6 @@ inline void LogPrintFormatInternal(std::source_location&& source_loc, BCLog::Log
#define LogWarning(...) LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Warning, /*should_ratelimit=*/true, __VA_ARGS__)
#define LogError(...) LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Error, /*should_ratelimit=*/true, __VA_ARGS__)
-// Deprecated unconditional logging.
-#define LogPrintf(...) LogInfo(__VA_ARGS__)
-
// Use a macro instead of a function for conditional logging to prevent
// evaluating arguments when logging for the category is not enabled.
diff --git a/src/test/logging_tests.cpp b/src/test/logging_tests.cpp
index 692d3eda..42658e94 100644
--- a/src/test/logging_tests.cpp
+++ b/src/test/logging_tests.cpp
@@ -142,15 +142,13 @@ BOOST_FIXTURE_TEST_CASE(logging_LogPrintStr, LogSetup)
BOOST_FIXTURE_TEST_CASE(logging_LogPrintMacrosDeprecated, LogSetup)
{
LogInstance().EnableCategory(BCLog::NET);
- LogInfo("foo5: %s\n", "bar5");
LogPrintLevel(BCLog::NET, BCLog::Level::Trace, "foo4: %s\n", "bar4"); // not logged
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "foo7: %s\n", "bar7");
LogPrintLevel(BCLog::NET, BCLog::Level::Info, "foo8: %s\n", "bar8");
LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "foo9: %s\n", "bar9");
LogPrintLevel(BCLog::NET, BCLog::Level::Error, "foo10: %s\n", "bar10");
std::vector<std::string> log_lines{ReadDebugLogLines()};
- std::vector<std::string> expected = {
- "foo5: bar5",
+ std::vector<std::string> expected{
"[net] foo7: bar7",
"[net:info] foo8: bar8",
"[net:warning] foo9: bar9",
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.