Skip to content

Commit 3333415

Browse files
author
MarcoFalke
committed
scripted-diff: LogPrint -> LogDebug
-BEGIN VERIFY SCRIPT- sed -i 's/\<LogPrint\>/LogDebug/g' $( git grep -l '\<LogPrint\>' -- ./contrib/ ./src/ ./test/ ':(exclude)src/logging.h' ) -END VERIFY SCRIPT-
1 parent d08bedd commit 3333415

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+356
-356
lines changed

contrib/devtools/bitcoin-tidy/example_logprintf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static inline void LogPrintf_(const std::string& logging_function, const std::st
2222
#define LogPrintLevel_(category, level, ...) LogPrintf_(__func__, __FILE__, __LINE__, category, level, __VA_ARGS__)
2323
#define LogPrintf(...) LogPrintLevel_(LogFlags::NONE, Level::None, __VA_ARGS__)
2424

25-
#define LogPrint(category, ...) \
25+
#define LogDebug(category, ...) \
2626
do { \
2727
LogPrintf(__VA_ARGS__); \
2828
} while (0)

src/addrman.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ void AddrManImpl::Unserialize(Stream& s_)
342342
serialized_asmap_checksum == supplied_asmap_checksum};
343343

344344
if (!restore_bucketing) {
345-
LogPrint(BCLog::ADDRMAN, "Bucketing method was updated, re-bucketing addrman entries from disk\n");
345+
LogDebug(BCLog::ADDRMAN, "Bucketing method was updated, re-bucketing addrman entries from disk\n");
346346
}
347347

348348
for (auto bucket_entry : bucket_entries) {
@@ -387,7 +387,7 @@ void AddrManImpl::Unserialize(Stream& s_)
387387
}
388388
}
389389
if (nLost + nLostUnk > 0) {
390-
LogPrint(BCLog::ADDRMAN, "addrman lost %i new and %i tried addresses due to collisions or invalid addresses\n", nLostUnk, nLost);
390+
LogDebug(BCLog::ADDRMAN, "addrman lost %i new and %i tried addresses due to collisions or invalid addresses\n", nLostUnk, nLost);
391391
}
392392

393393
const int check_code{CheckAddrman()};
@@ -481,7 +481,7 @@ void AddrManImpl::ClearNew(int nUBucket, int nUBucketPos)
481481
assert(infoDelete.nRefCount > 0);
482482
infoDelete.nRefCount--;
483483
vvNew[nUBucket][nUBucketPos] = -1;
484-
LogPrint(BCLog::ADDRMAN, "Removed %s from new[%i][%i]\n", infoDelete.ToStringAddrPort(), nUBucket, nUBucketPos);
484+
LogDebug(BCLog::ADDRMAN, "Removed %s from new[%i][%i]\n", infoDelete.ToStringAddrPort(), nUBucket, nUBucketPos);
485485
if (infoDelete.nRefCount == 0) {
486486
Delete(nIdDelete);
487487
}
@@ -536,7 +536,7 @@ void AddrManImpl::MakeTried(AddrInfo& info, int nId)
536536
vvNew[nUBucket][nUBucketPos] = nIdEvict;
537537
nNew++;
538538
m_network_counts[infoOld.GetNetwork()].n_new++;
539-
LogPrint(BCLog::ADDRMAN, "Moved %s from tried[%i][%i] to new[%i][%i] to make space\n",
539+
LogDebug(BCLog::ADDRMAN, "Moved %s from tried[%i][%i] to new[%i][%i] to make space\n",
540540
infoOld.ToStringAddrPort(), nKBucket, nKBucketPos, nUBucket, nUBucketPos);
541541
}
542542
assert(vvTried[nKBucket][nKBucketPos] == -1);
@@ -612,7 +612,7 @@ bool AddrManImpl::AddSingle(const CAddress& addr, const CNetAddr& source, std::c
612612
pinfo->nRefCount++;
613613
vvNew[nUBucket][nUBucketPos] = nId;
614614
const auto mapped_as{m_netgroupman.GetMappedAS(addr)};
615-
LogPrint(BCLog::ADDRMAN, "Added %s%s to new[%i][%i]\n",
615+
LogDebug(BCLog::ADDRMAN, "Added %s%s to new[%i][%i]\n",
616616
addr.ToStringAddrPort(), (mapped_as ? strprintf(" mapped to AS%i", mapped_as) : ""), nUBucket, nUBucketPos);
617617
} else {
618618
if (pinfo->nRefCount == 0) {
@@ -663,7 +663,7 @@ bool AddrManImpl::Good_(const CService& addr, bool test_before_evict, NodeSecond
663663
}
664664
// Output the entry we'd be colliding with, for debugging purposes
665665
auto colliding_entry = mapInfo.find(vvTried[tried_bucket][tried_bucket_pos]);
666-
LogPrint(BCLog::ADDRMAN, "Collision with %s while attempting to move %s to tried table. Collisions=%d\n",
666+
LogDebug(BCLog::ADDRMAN, "Collision with %s while attempting to move %s to tried table. Collisions=%d\n",
667667
colliding_entry != mapInfo.end() ? colliding_entry->second.ToStringAddrPort() : "",
668668
addr.ToStringAddrPort(),
669669
m_tried_collisions.size());
@@ -672,7 +672,7 @@ bool AddrManImpl::Good_(const CService& addr, bool test_before_evict, NodeSecond
672672
// move nId to the tried tables
673673
MakeTried(info, nId);
674674
const auto mapped_as{m_netgroupman.GetMappedAS(addr)};
675-
LogPrint(BCLog::ADDRMAN, "Moved %s%s to tried[%i][%i]\n",
675+
LogDebug(BCLog::ADDRMAN, "Moved %s%s to tried[%i][%i]\n",
676676
addr.ToStringAddrPort(), (mapped_as ? strprintf(" mapped to AS%i", mapped_as) : ""), tried_bucket, tried_bucket_pos);
677677
return true;
678678
}
@@ -685,7 +685,7 @@ bool AddrManImpl::Add_(const std::vector<CAddress>& vAddr, const CNetAddr& sourc
685685
added += AddSingle(*it, source, time_penalty) ? 1 : 0;
686686
}
687687
if (added > 0) {
688-
LogPrint(BCLog::ADDRMAN, "Added %i addresses (of %i) from %s: %i tried, %i new\n", added, vAddr.size(), source.ToStringAddr(), nTried, nNew);
688+
LogDebug(BCLog::ADDRMAN, "Added %i addresses (of %i) from %s: %i tried, %i new\n", added, vAddr.size(), source.ToStringAddr(), nTried, nNew);
689689
}
690690
return added > 0;
691691
}
@@ -777,7 +777,7 @@ std::pair<CAddress, NodeSeconds> AddrManImpl::Select_(bool new_only, std::option
777777

778778
// With probability GetChance() * chance_factor, return the entry.
779779
if (insecure_rand.randbits<30>() < chance_factor * info.GetChance() * (1 << 30)) {
780-
LogPrint(BCLog::ADDRMAN, "Selected %s from %s\n", info.ToStringAddrPort(), search_tried ? "tried" : "new");
780+
LogDebug(BCLog::ADDRMAN, "Selected %s from %s\n", info.ToStringAddrPort(), search_tried ? "tried" : "new");
781781
return {info, info.m_last_try};
782782
}
783783

@@ -837,7 +837,7 @@ std::vector<CAddress> AddrManImpl::GetAddr_(size_t max_addresses, size_t max_pct
837837

838838
addresses.push_back(ai);
839839
}
840-
LogPrint(BCLog::ADDRMAN, "GetAddr returned %d random addresses\n", addresses.size());
840+
LogDebug(BCLog::ADDRMAN, "GetAddr returned %d random addresses\n", addresses.size());
841841
return addresses;
842842
}
843843

@@ -935,7 +935,7 @@ void AddrManImpl::ResolveCollisions_()
935935

936936
// Give address at least 60 seconds to successfully connect
937937
if (current_time - info_old.m_last_try > 60s) {
938-
LogPrint(BCLog::ADDRMAN, "Replacing %s with %s in tried table\n", info_old.ToStringAddrPort(), info_new.ToStringAddrPort());
938+
LogDebug(BCLog::ADDRMAN, "Replacing %s with %s in tried table\n", info_old.ToStringAddrPort(), info_new.ToStringAddrPort());
939939

940940
// Replaces an existing address already in the tried table with the new address
941941
Good_(info_new, false, current_time);
@@ -945,7 +945,7 @@ void AddrManImpl::ResolveCollisions_()
945945
// If the collision hasn't resolved in some reasonable amount of time,
946946
// just evict the old entry -- we must not be able to
947947
// connect to it for some reason.
948-
LogPrint(BCLog::ADDRMAN, "Unable to test; replacing %s with %s in tried table anyway\n", info_old.ToStringAddrPort(), info_new.ToStringAddrPort());
948+
LogDebug(BCLog::ADDRMAN, "Unable to test; replacing %s with %s in tried table anyway\n", info_old.ToStringAddrPort(), info_new.ToStringAddrPort());
949949
Good_(info_new, false, current_time);
950950
erase_collision = true;
951951
}

src/banman.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void BanMan::LoadBanlist()
3636
if (m_ban_db.Read(m_banned)) {
3737
SweepBanned(); // sweep out unused entries
3838

39-
LogPrint(BCLog::NET, "Loaded %d banned node addresses/subnets %dms\n", m_banned.size(),
39+
LogDebug(BCLog::NET, "Loaded %d banned node addresses/subnets %dms\n", m_banned.size(),
4040
Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
4141
} else {
4242
LogPrintf("Recreating the banlist database\n");
@@ -65,7 +65,7 @@ void BanMan::DumpBanlist()
6565
m_is_dirty = true;
6666
}
6767

68-
LogPrint(BCLog::NET, "Flushed %d banned node addresses/subnets to disk %dms\n", banmap.size(),
68+
LogDebug(BCLog::NET, "Flushed %d banned node addresses/subnets to disk %dms\n", banmap.size(),
6969
Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
7070
}
7171

@@ -193,7 +193,7 @@ void BanMan::SweepBanned()
193193
m_banned.erase(it++);
194194
m_is_dirty = true;
195195
notify_ui = true;
196-
LogPrint(BCLog::NET, "Removed banned node address/subnet: %s\n", sub_net.ToString());
196+
LogDebug(BCLog::NET, "Removed banned node address/subnet: %s\n", sub_net.ToString());
197197
} else {
198198
++it;
199199
}

src/bench/logging.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ static void LogPrintLevelWithoutThreadNames(benchmark::Bench& bench)
4242

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

4848
static void LogPrintWithoutCategory(benchmark::Bench& bench)
4949
{
50-
Logging(bench, {"-logthreadnames=0", "-debug=0"}, [] { LogPrint(BCLog::NET, "%s\n", "test"); });
50+
Logging(bench, {"-logthreadnames=0", "-debug=0"}, [] { LogDebug(BCLog::NET, "%s\n", "test"); });
5151
}
5252

5353
static void LogPrintfCategoryWithThreadNames(benchmark::Bench& bench)
@@ -79,7 +79,7 @@ static void LogWithoutWriteToFile(benchmark::Bench& bench)
7979
// Disable writing the log to a file, as used for unit tests and fuzzing in `MakeNoLogFileContext`.
8080
Logging(bench, {"-nodebuglogfile", "-debug=1"}, [] {
8181
LogPrintf("%s\n", "test");
82-
LogPrint(BCLog::NET, "%s\n", "test");
82+
LogDebug(BCLog::NET, "%s\n", "test");
8383
});
8484
}
8585

src/blockencodings.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c
167167
break;
168168
}
169169

170-
LogPrint(BCLog::CMPCTBLOCK, "Initialized PartiallyDownloadedBlock for block %s using a cmpctblock of size %lu\n", cmpctblock.header.GetHash().ToString(), GetSerializeSize(cmpctblock));
170+
LogDebug(BCLog::CMPCTBLOCK, "Initialized PartiallyDownloadedBlock for block %s using a cmpctblock of size %lu\n", cmpctblock.header.GetHash().ToString(), GetSerializeSize(cmpctblock));
171171

172172
return READ_STATUS_OK;
173173
}
@@ -217,10 +217,10 @@ ReadStatus PartiallyDownloadedBlock::FillBlock(CBlock& block, const std::vector<
217217
return READ_STATUS_CHECKBLOCK_FAILED;
218218
}
219219

220-
LogPrint(BCLog::CMPCTBLOCK, "Successfully reconstructed block %s with %lu txn prefilled, %lu txn from mempool (incl at least %lu from extra pool) and %lu txn requested\n", hash.ToString(), prefilled_count, mempool_count, extra_count, vtx_missing.size());
220+
LogDebug(BCLog::CMPCTBLOCK, "Successfully reconstructed block %s with %lu txn prefilled, %lu txn from mempool (incl at least %lu from extra pool) and %lu txn requested\n", hash.ToString(), prefilled_count, mempool_count, extra_count, vtx_missing.size());
221221
if (vtx_missing.size() < 5) {
222222
for (const auto& tx : vtx_missing) {
223-
LogPrint(BCLog::CMPCTBLOCK, "Reconstructed block %s required tx %s\n", hash.ToString(), tx->GetHash().ToString());
223+
LogDebug(BCLog::CMPCTBLOCK, "Reconstructed block %s required tx %s\n", hash.ToString(), tx->GetHash().ToString());
224224
}
225225
}
226226

src/dbwrapper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static void SetMaxOpenFiles(leveldb::Options *options) {
130130
options->max_open_files = 64;
131131
}
132132
#endif
133-
LogPrint(BCLog::LEVELDB, "LevelDB using max_open_files=%d (default=%d)\n",
133+
LogDebug(BCLog::LEVELDB, "LevelDB using max_open_files=%d (default=%d)\n",
134134
options->max_open_files, default_open_files);
135135
}
136136

@@ -299,7 +299,7 @@ bool CDBWrapper::WriteBatch(CDBBatch& batch, bool fSync)
299299
HandleError(status);
300300
if (log_memory) {
301301
double mem_after = DynamicMemoryUsage() / 1024.0 / 1024;
302-
LogPrint(BCLog::LEVELDB, "WriteBatch memory usage: db=%s, before=%.1fMiB, after=%.1fMiB\n",
302+
LogDebug(BCLog::LEVELDB, "WriteBatch memory usage: db=%s, before=%.1fMiB, after=%.1fMiB\n",
303303
m_name, mem_before, mem_after);
304304
}
305305
return true;
@@ -310,7 +310,7 @@ size_t CDBWrapper::DynamicMemoryUsage() const
310310
std::string memory;
311311
std::optional<size_t> parsed;
312312
if (!DBContext().pdb->GetProperty("leveldb.approximate-memory-usage", &memory) || !(parsed = ToIntegral<size_t>(memory))) {
313-
LogPrint(BCLog::LEVELDB, "Failed to get approximate-memory-usage property\n");
313+
LogDebug(BCLog::LEVELDB, "Failed to get approximate-memory-usage property\n");
314314
return 0;
315315
}
316316
return parsed.value();

src/flatfile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ size_t FlatFileSeq::Allocate(const FlatFilePos& pos, size_t add_size, bool& out_
6666
if (CheckDiskSpace(m_dir, inc_size)) {
6767
FILE *file = Open(pos);
6868
if (file) {
69-
LogPrint(BCLog::VALIDATION, "Pre-allocating up to position 0x%x in %s%05u.dat\n", new_size, m_prefix, pos.nFile);
69+
LogDebug(BCLog::VALIDATION, "Pre-allocating up to position 0x%x in %s%05u.dat\n", new_size, m_prefix, pos.nFile);
7070
AllocateFileRange(file, pos.nPos, inc_size);
7171
fclose(file);
7272
return inc_size;

0 commit comments

Comments
 (0)