Skip to content

Commit fa18376

Browse files
author
MarcoFalke
committed
log: Remove function name from init logs
It is redundant with -logsourcelocations and the log messages are clearer without it. Also, remove a double-space. Also, add braces around `if` touched in the next commit. This tiny behavior change requires a test fixup.
1 parent e17fb86 commit fa18376

File tree

7 files changed

+14
-13
lines changed

7 files changed

+14
-13
lines changed

src/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ void Shutdown(NodeContext& node)
284284
static Mutex g_shutdown_mutex;
285285
TRY_LOCK(g_shutdown_mutex, lock_shutdown);
286286
if (!lock_shutdown) return;
287-
LogPrintf("%s: In progress...\n", __func__);
287+
LogInfo("Shutdown in progress...");
288288
Assert(node.args);
289289

290290
/// Note: Shutdown() must be able to handle cases in which initialization failed part of the way,
@@ -395,7 +395,7 @@ void Shutdown(NodeContext& node)
395395

396396
RemovePidFile(*node.args);
397397

398-
LogPrintf("%s: done\n", __func__);
398+
LogInfo("Shutdown done");
399399
}
400400

401401
/**

src/init/common.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ bool StartLogging(const ArgsManager& args)
114114
fs::PathToString(LogInstance().m_file_path))));
115115
}
116116

117-
if (!LogInstance().m_log_timestamps)
117+
if (!LogInstance().m_log_timestamps) {
118118
LogPrintf("Startup time: %s\n", FormatISO8601DateTime(GetTime()));
119+
}
119120
LogPrintf("Default data directory %s\n", fs::PathToString(GetDefaultDataDir()));
120121
LogPrintf("Using data directory %s\n", fs::PathToString(gArgs.GetDataDirNet()));
121122

src/node/blockstorage.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,11 @@ bool BlockManager::LoadBlockIndexDB(const std::optional<uint256>& snapshot_block
508508
// Load block file info
509509
m_block_tree_db->ReadLastBlockFile(max_blockfile_num);
510510
m_blockfile_info.resize(max_blockfile_num + 1);
511-
LogPrintf("%s: last block file = %i\n", __func__, max_blockfile_num);
511+
LogInfo("Loading block index db: last block file = %i", max_blockfile_num);
512512
for (int nFile = 0; nFile <= max_blockfile_num; nFile++) {
513513
m_block_tree_db->ReadBlockFileInfo(nFile, m_blockfile_info[nFile]);
514514
}
515-
LogPrintf("%s: last block file info: %s\n", __func__, m_blockfile_info[max_blockfile_num].ToString());
515+
LogInfo("Loading block index db: last block file info: %s", m_blockfile_info[max_blockfile_num].ToString());
516516
for (int nFile = max_blockfile_num + 1; true; nFile++) {
517517
CBlockFileInfo info;
518518
if (m_block_tree_db->ReadBlockFileInfo(nFile, info)) {
@@ -549,7 +549,7 @@ bool BlockManager::LoadBlockIndexDB(const std::optional<uint256>& snapshot_block
549549
// Check whether we have ever pruned block & undo files
550550
m_block_tree_db->ReadFlag("prunedblockfiles", m_have_pruned);
551551
if (m_have_pruned) {
552-
LogPrintf("LoadBlockIndexDB(): Block files have previously been pruned\n");
552+
LogInfo("Loading block index db: Block files have previously been pruned");
553553
}
554554

555555
// Check whether we need to continue reindexing
@@ -1236,7 +1236,7 @@ void ImportBlocks(ChainstateManager& chainman, std::span<const fs::path> import_
12361236
LogPrintf("Reindexing block file blk%05u.dat...\n", (unsigned int)nFile);
12371237
chainman.LoadExternalBlockFile(file, &pos, &blocks_with_unknown_parent);
12381238
if (chainman.m_interrupt) {
1239-
LogPrintf("Interrupt requested. Exit %s\n", __func__);
1239+
LogInfo("Interrupt requested. Exit reindexing.");
12401240
return;
12411241
}
12421242
nFile++;
@@ -1255,7 +1255,7 @@ void ImportBlocks(ChainstateManager& chainman, std::span<const fs::path> import_
12551255
LogPrintf("Importing blocks file %s...\n", fs::PathToString(path));
12561256
chainman.LoadExternalBlockFile(file);
12571257
if (chainman.m_interrupt) {
1258-
LogPrintf("Interrupt requested. Exit %s\n", __func__);
1258+
LogInfo("Interrupt requested. Exit block importing.");
12591259
return;
12601260
}
12611261
} else {

src/node/chainstate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
154154
LogPrintf("Warning: nMinimumChainWork set below default value of %s\n", chainman.GetConsensus().nMinimumChainWork.GetHex());
155155
}
156156
if (chainman.m_blockman.GetPruneTarget() == BlockManager::PRUNE_TARGET_MANUAL) {
157-
LogPrintf("Block pruning enabled. Use RPC call pruneblockchain(height) to manually prune block and undo files.\n");
157+
LogInfo("Block pruning enabled. Use RPC call pruneblockchain(height) to manually prune block and undo files.");
158158
} else if (chainman.m_blockman.GetPruneTarget()) {
159159
LogPrintf("Prune configured to target %u MiB on disk for block and undo files.\n", chainman.m_blockman.GetPruneTarget() / 1024 / 1024);
160160
}

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4768,7 +4768,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
47684768
if ((chainstate.m_blockman.IsPruneMode() || is_snapshot_cs) && !(pindex->nStatus & BLOCK_HAVE_DATA)) {
47694769
// If pruning or running under an assumeutxo snapshot, only go
47704770
// back as far as we have data.
4771-
LogPrintf("VerifyDB(): block verification stopping at height %d (no data). This could be due to pruning or use of an assumeutxo snapshot.\n", pindex->nHeight);
4771+
LogInfo("Block verification stopping at height %d (no data). This could be due to pruning or use of an assumeutxo snapshot.", pindex->nHeight);
47724772
skipped_no_block_data = true;
47734773
break;
47744774
}

src/wallet/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ bool WalletInit::ParameterInteraction() const
8888
{
8989
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) {
9090
for (const std::string& wallet : gArgs.GetArgs("-wallet")) {
91-
LogPrintf("%s: parameter interaction: -disablewallet -> ignoring -wallet=%s\n", __func__, wallet);
91+
LogInfo("Parameter interaction: -disablewallet -> ignoring -wallet=%s", wallet);
9292
}
9393

9494
return true;
9595
}
9696

9797
if (gArgs.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY) && gArgs.SoftSetBoolArg("-walletbroadcast", false)) {
98-
LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__);
98+
LogInfo("Parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0");
9999
}
100100

101101
return true;

test/functional/feature_pruning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def reorg_test(self):
225225
def reorg_back(self):
226226
# Verify that a block on the old main chain fork has been pruned away
227227
assert_raises_rpc_error(-1, "Block not available (pruned data)", self.nodes[2].getblock, self.forkhash)
228-
with self.nodes[2].assert_debug_log(expected_msgs=['block verification stopping at height', '(no data)']):
228+
with self.nodes[2].assert_debug_log(expected_msgs=["Block verification stopping at height", "(no data)"]):
229229
assert not self.nodes[2].verifychain(checklevel=4, nblocks=0)
230230
self.log.info(f"Will need to redownload block {self.forkheight}")
231231

0 commit comments

Comments
 (0)