Skip to content

Commit fa09cb4

Browse files
author
MarcoFalke
committed
refactor: Remove unused LogPrint
1 parent 3333415 commit fa09cb4

File tree

6 files changed

+7
-15
lines changed

6 files changed

+7
-15
lines changed

doc/developer-notes.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,8 +741,6 @@ logging messages. They should be used as follows:
741741
useful for debugging and can reasonably be enabled on a production
742742
system (that has sufficient free storage space). They will be logged
743743
if the program is started with `-debug=category` or `-debug=1`.
744-
Note that `LogPrint(BCLog::CATEGORY, fmt, params...)` is a deprecated
745-
alias for `LogDebug`.
746744

747745
- `LogInfo(fmt, params...)` should only be used rarely, e.g. for startup
748746
messages or for infrequent and important events such as a new block tip

doc/fuzzing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ index 7601a6ea84..702d0f56ce 100644
257257
// Check start string, network magic
258258
- if (memcmp(hdr.pchMessageStart, m_chain_params.MessageStart(), CMessageHeader::MESSAGE_START_SIZE) != 0) {
259259
+ if (false && memcmp(hdr.pchMessageStart, m_chain_params.MessageStart(), CMessageHeader::MESSAGE_START_SIZE) != 0) { // skip network magic checking
260-
LogPrint(BCLog::NET, "Header error: Wrong MessageStart %s received, peer=%d\n", HexStr(hdr.pchMessageStart), m_node_id);
260+
LogDebug(BCLog::NET, "Header error: Wrong MessageStart %s received, peer=%d\n", HexStr(hdr.pchMessageStart), m_node_id);
261261
return -1;
262262
}
263263
@@ -788,7 +788,7 @@ CNetMessage V1TransportDeserializer::GetMessage(const std::chrono::microseconds
@@ -266,7 +266,7 @@ index 7601a6ea84..702d0f56ce 100644
266266
// Check checksum and header message type string
267267
- if (memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) {
268268
+ if (false && memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) { // skip checksum checking
269-
LogPrint(BCLog::NET, "Header error: Wrong checksum (%s, %u bytes), expected %s was %s, peer=%d\n",
269+
LogDebug(BCLog::NET, "Header error: Wrong checksum (%s, %u bytes), expected %s was %s, peer=%d\n",
270270
SanitizeString(msg.m_type), msg.m_message_size,
271271
HexStr(Span{hash}.first(CMessageHeader::CHECKSUM_SIZE)),
272272
EOF

src/bench/logging.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
// All but 2 of the benchmarks should have roughly similar performance:
1313
//
14-
// LogPrintWithoutCategory should be ~3 orders of magnitude faster, as nothing is logged.
14+
// LogWithoutDebug should be ~3 orders of magnitude faster, as nothing is logged.
1515
//
1616
// LogWithoutWriteToFile should be ~2 orders of magnitude faster, as it avoids disk writes.
1717

@@ -40,12 +40,12 @@ static void LogPrintLevelWithoutThreadNames(benchmark::Bench& bench)
4040
LogPrintLevel(BCLog::NET, BCLog::Level::Error, "%s\n", "test"); });
4141
}
4242

43-
static void LogPrintWithCategory(benchmark::Bench& bench)
43+
static void LogWithDebug(benchmark::Bench& bench)
4444
{
4545
Logging(bench, {"-logthreadnames=0", "-debug=net"}, [] { LogDebug(BCLog::NET, "%s\n", "test"); });
4646
}
4747

48-
static void LogPrintWithoutCategory(benchmark::Bench& bench)
48+
static void LogWithoutDebug(benchmark::Bench& bench)
4949
{
5050
Logging(bench, {"-logthreadnames=0", "-debug=0"}, [] { LogDebug(BCLog::NET, "%s\n", "test"); });
5151
}
@@ -85,8 +85,8 @@ static void LogWithoutWriteToFile(benchmark::Bench& bench)
8585

8686
BENCHMARK(LogPrintLevelWithThreadNames, benchmark::PriorityLevel::HIGH);
8787
BENCHMARK(LogPrintLevelWithoutThreadNames, benchmark::PriorityLevel::HIGH);
88-
BENCHMARK(LogPrintWithCategory, benchmark::PriorityLevel::HIGH);
89-
BENCHMARK(LogPrintWithoutCategory, benchmark::PriorityLevel::HIGH);
88+
BENCHMARK(LogWithDebug, benchmark::PriorityLevel::HIGH);
89+
BENCHMARK(LogWithoutDebug, benchmark::PriorityLevel::HIGH);
9090
BENCHMARK(LogPrintfCategoryWithThreadNames, benchmark::PriorityLevel::HIGH);
9191
BENCHMARK(LogPrintfCategoryWithoutThreadNames, benchmark::PriorityLevel::HIGH);
9292
BENCHMARK(LogPrintfWithThreadNames, benchmark::PriorityLevel::HIGH);

src/logging.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,4 @@ static inline void LogPrintf_(std::string_view logging_function, std::string_vie
289289
#define LogDebug(category, ...) LogPrintLevel(category, BCLog::Level::Debug, __VA_ARGS__)
290290
#define LogTrace(category, ...) LogPrintLevel(category, BCLog::Level::Trace, __VA_ARGS__)
291291

292-
// Deprecated conditional logging
293-
#define LogPrint(category, ...) LogDebug(category, __VA_ARGS__)
294-
295292
#endif // BITCOIN_LOGGING_H

src/test/logging_tests.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ BOOST_FIXTURE_TEST_CASE(logging_LogPrintf_, LogSetup)
111111
BOOST_FIXTURE_TEST_CASE(logging_LogPrintMacrosDeprecated, LogSetup)
112112
{
113113
LogPrintf("foo5: %s\n", "bar5");
114-
LogDebug(BCLog::NET, "foo6: %s\n", "bar6");
115114
LogPrintLevel(BCLog::NET, BCLog::Level::Trace, "foo4: %s\n", "bar4"); // not logged
116115
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "foo7: %s\n", "bar7");
117116
LogPrintLevel(BCLog::NET, BCLog::Level::Info, "foo8: %s\n", "bar8");
@@ -125,7 +124,6 @@ BOOST_FIXTURE_TEST_CASE(logging_LogPrintMacrosDeprecated, LogSetup)
125124
}
126125
std::vector<std::string> expected = {
127126
"foo5: bar5",
128-
"[net] foo6: bar6",
129127
"[net] foo7: bar7",
130128
"[net:info] foo8: bar8",
131129
"[net:warning] foo9: bar9",

test/lint/lint-format-strings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
'LogInfo,0',
2626
'LogDebug,1',
2727
'LogTrace,1',
28-
'LogDebug,1',
2928
'LogPrintf,0',
3029
'LogPrintfCategory,1',
3130
'LogPrintLevel,2',

0 commit comments

Comments
 (0)