0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-14 11:26:09 -05:00

refactor: Remove unused LogPrintf

This commit is contained in:
MarcoFalke 2024-03-12 21:27:55 +01:00
parent 701ca86ac5
commit b38666638d
3 changed files with 1 additions and 7 deletions

View file

@ -753,8 +753,7 @@ logging messages. They should be used as follows:
messages or for infrequent and important events such as a new block tip 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 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 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 attacker to fill up storage.
a deprecated alias for `LogInfo`.
- `LogError(fmt, params...)` should be used in place of `LogInfo` for - `LogError(fmt, params...)` should be used in place of `LogInfo` for
severe problems that require the node (or a subsystem) to shut down severe problems that require the node (or a subsystem) to shut down

View file

@ -262,9 +262,6 @@ inline void LogPrintFormatInternal(std::string_view logging_function, std::strin
#define LogWarning(...) LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Warning, __VA_ARGS__) #define LogWarning(...) LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Warning, __VA_ARGS__)
#define LogError(...) LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Error, __VA_ARGS__) #define LogError(...) LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Error, __VA_ARGS__)
// Deprecated unconditional logging.
#define LogPrintf(...) LogInfo(__VA_ARGS__)
// Use a macro instead of a function for conditional logging to prevent // Use a macro instead of a function for conditional logging to prevent
// evaluating arguments when logging for the category is not enabled. // evaluating arguments when logging for the category is not enabled.

View file

@ -110,7 +110,6 @@ BOOST_FIXTURE_TEST_CASE(logging_LogPrintStr, LogSetup)
BOOST_FIXTURE_TEST_CASE(logging_LogPrintMacrosDeprecated, LogSetup) BOOST_FIXTURE_TEST_CASE(logging_LogPrintMacrosDeprecated, LogSetup)
{ {
LogInfo("foo5: %s\n", "bar5");
LogPrintLevel(BCLog::NET, BCLog::Level::Trace, "foo4: %s\n", "bar4"); // not logged 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::Debug, "foo7: %s\n", "bar7");
LogPrintLevel(BCLog::NET, BCLog::Level::Info, "foo8: %s\n", "bar8"); LogPrintLevel(BCLog::NET, BCLog::Level::Info, "foo8: %s\n", "bar8");
@ -122,7 +121,6 @@ BOOST_FIXTURE_TEST_CASE(logging_LogPrintMacrosDeprecated, LogSetup)
log_lines.push_back(log); log_lines.push_back(log);
} }
std::vector<std::string> expected = { std::vector<std::string> expected = {
"foo5: bar5",
"[net] foo7: bar7", "[net] foo7: bar7",
"[net:info] foo8: bar8", "[net:info] foo8: bar8",
"[net:warning] foo9: bar9", "[net:warning] foo9: bar9",