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.
This commit is contained in:
MarcoFalke committed 2025-07-25 09:50:24 +02:00
1 parent e17fb86382
commit fa183761cb
7 files changed
+14 -13

No files matched your search

+2 -2
View File
@@ -284,7 +284,7 @@ void Shutdown(NodeContext& node)
static Mutex g_shutdown_mutex; static Mutex g_shutdown_mutex;
TRY_LOCK(g_shutdown_mutex, lock_shutdown); TRY_LOCK(g_shutdown_mutex, lock_shutdown);
if (!lock_shutdown) return; if (!lock_shutdown) return;
LogPrintf("%s: In progress...\n", __func__); LogInfo("Shutdown in progress...");
Assert(node.args); Assert(node.args);
/// Note: Shutdown() must be able to handle cases in which initialization failed part of the way, /// Note: Shutdown() must be able to handle cases in which initialization failed part of the way,
@@ -395,7 +395,7 @@ void Shutdown(NodeContext& node)
RemovePidFile(*node.args); RemovePidFile(*node.args);
LogPrintf("%s: done\n", __func__); LogInfo("Shutdown done");
} }
/** /**
+2 -1
View File
@@ -114,8 +114,9 @@ bool StartLogging(const ArgsManager& args)
fs::PathToString(LogInstance().m_file_path)))); fs::PathToString(LogInstance().m_file_path))));
} }
if (!LogInstance().m_log_timestamps) if (!LogInstance().m_log_timestamps) {
LogPrintf("Startup time: %s\n", FormatISO8601DateTime(GetTime())); LogPrintf("Startup time: %s\n", FormatISO8601DateTime(GetTime()));
}
LogPrintf("Default data directory %s\n", fs::PathToString(GetDefaultDataDir())); LogPrintf("Default data directory %s\n", fs::PathToString(GetDefaultDataDir()));
LogPrintf("Using data directory %s\n", fs::PathToString(gArgs.GetDataDirNet())); LogPrintf("Using data directory %s\n", fs::PathToString(gArgs.GetDataDirNet()));
+5 -5
View File
@@ -508,11 +508,11 @@ bool BlockManager::LoadBlockIndexDB(const std::optional<uint256>& snapshot_block
// Load block file info // Load block file info
m_block_tree_db->ReadLastBlockFile(max_blockfile_num); m_block_tree_db->ReadLastBlockFile(max_blockfile_num);
m_blockfile_info.resize(max_blockfile_num + 1); m_blockfile_info.resize(max_blockfile_num + 1);
LogPrintf("%s: last block file = %i\n", __func__, max_blockfile_num); LogInfo("Loading block index db: last block file = %i", max_blockfile_num);
for (int nFile = 0; nFile <= max_blockfile_num; nFile++) { for (int nFile = 0; nFile <= max_blockfile_num; nFile++) {
m_block_tree_db->ReadBlockFileInfo(nFile, m_blockfile_info[nFile]); m_block_tree_db->ReadBlockFileInfo(nFile, m_blockfile_info[nFile]);
} }
LogPrintf("%s: last block file info: %s\n", __func__, m_blockfile_info[max_blockfile_num].ToString()); LogInfo("Loading block index db: last block file info: %s", m_blockfile_info[max_blockfile_num].ToString());
for (int nFile = max_blockfile_num + 1; true; nFile++) { for (int nFile = max_blockfile_num + 1; true; nFile++) {
CBlockFileInfo info; CBlockFileInfo info;
if (m_block_tree_db->ReadBlockFileInfo(nFile, info)) { if (m_block_tree_db->ReadBlockFileInfo(nFile, info)) {
@@ -549,7 +549,7 @@ bool BlockManager::LoadBlockIndexDB(const std::optional<uint256>& snapshot_block
// Check whether we have ever pruned block & undo files // Check whether we have ever pruned block & undo files
m_block_tree_db->ReadFlag("prunedblockfiles", m_have_pruned); m_block_tree_db->ReadFlag("prunedblockfiles", m_have_pruned);
if (m_have_pruned) { if (m_have_pruned) {
LogPrintf("LoadBlockIndexDB(): Block files have previously been pruned\n"); LogInfo("Loading block index db: Block files have previously been pruned");
} }
// Check whether we need to continue reindexing // Check whether we need to continue reindexing
@@ -1236,7 +1236,7 @@ void ImportBlocks(ChainstateManager& chainman, std::span<const fs::path> import_
LogPrintf("Reindexing block file blk%05u.dat...\n", (unsigned int)nFile); LogPrintf("Reindexing block file blk%05u.dat...\n", (unsigned int)nFile);
chainman.LoadExternalBlockFile(file, &pos, &blocks_with_unknown_parent); chainman.LoadExternalBlockFile(file, &pos, &blocks_with_unknown_parent);
if (chainman.m_interrupt) { if (chainman.m_interrupt) {
LogPrintf("Interrupt requested. Exit %s\n", __func__); LogInfo("Interrupt requested. Exit reindexing.");
return; return;
} }
nFile++; nFile++;
@@ -1255,7 +1255,7 @@ void ImportBlocks(ChainstateManager& chainman, std::span<const fs::path> import_
LogPrintf("Importing blocks file %s...\n", fs::PathToString(path)); LogPrintf("Importing blocks file %s...\n", fs::PathToString(path));
chainman.LoadExternalBlockFile(file); chainman.LoadExternalBlockFile(file);
if (chainman.m_interrupt) { if (chainman.m_interrupt) {
LogPrintf("Interrupt requested. Exit %s\n", __func__); LogInfo("Interrupt requested. Exit block importing.");
return; return;
} }
} else { } else {
+1 -1
View File
@@ -154,7 +154,7 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
LogPrintf("Warning: nMinimumChainWork set below default value of %s\n", chainman.GetConsensus().nMinimumChainWork.GetHex()); LogPrintf("Warning: nMinimumChainWork set below default value of %s\n", chainman.GetConsensus().nMinimumChainWork.GetHex());
} }
if (chainman.m_blockman.GetPruneTarget() == BlockManager::PRUNE_TARGET_MANUAL) { if (chainman.m_blockman.GetPruneTarget() == BlockManager::PRUNE_TARGET_MANUAL) {
LogPrintf("Block pruning enabled. Use RPC call pruneblockchain(height) to manually prune block and undo files.\n"); LogInfo("Block pruning enabled. Use RPC call pruneblockchain(height) to manually prune block and undo files.");
} else if (chainman.m_blockman.GetPruneTarget()) { } else if (chainman.m_blockman.GetPruneTarget()) {
LogPrintf("Prune configured to target %u MiB on disk for block and undo files.\n", chainman.m_blockman.GetPruneTarget() / 1024 / 1024); LogPrintf("Prune configured to target %u MiB on disk for block and undo files.\n", chainman.m_blockman.GetPruneTarget() / 1024 / 1024);
} }
+1 -1
View File
@@ -4768,7 +4768,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
if ((chainstate.m_blockman.IsPruneMode() || is_snapshot_cs) && !(pindex->nStatus & BLOCK_HAVE_DATA)) { if ((chainstate.m_blockman.IsPruneMode() || is_snapshot_cs) && !(pindex->nStatus & BLOCK_HAVE_DATA)) {
// If pruning or running under an assumeutxo snapshot, only go // If pruning or running under an assumeutxo snapshot, only go
// back as far as we have data. // back as far as we have data.
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); LogInfo("Block verification stopping at height %d (no data). This could be due to pruning or use of an assumeutxo snapshot.", pindex->nHeight);
skipped_no_block_data = true; skipped_no_block_data = true;
break; break;
} }
+2 -2
View File
@@ -88,14 +88,14 @@ bool WalletInit::ParameterInteraction() const
{ {
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) { if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) {
for (const std::string& wallet : gArgs.GetArgs("-wallet")) { for (const std::string& wallet : gArgs.GetArgs("-wallet")) {
LogPrintf("%s: parameter interaction: -disablewallet -> ignoring -wallet=%s\n", __func__, wallet); LogInfo("Parameter interaction: -disablewallet -> ignoring -wallet=%s", wallet);
} }
return true; return true;
} }
if (gArgs.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY) && gArgs.SoftSetBoolArg("-walletbroadcast", false)) { if (gArgs.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY) && gArgs.SoftSetBoolArg("-walletbroadcast", false)) {
LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__); LogInfo("Parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0");
} }
return true; return true;
+1 -1
View File
@@ -225,7 +225,7 @@ class PruneTest(BitcoinTestFramework):
def reorg_back(self): def reorg_back(self):
# Verify that a block on the old main chain fork has been pruned away # Verify that a block on the old main chain fork has been pruned away
assert_raises_rpc_error(-1, "Block not available (pruned data)", self.nodes[2].getblock, self.forkhash) assert_raises_rpc_error(-1, "Block not available (pruned data)", self.nodes[2].getblock, self.forkhash)
with self.nodes[2].assert_debug_log(expected_msgs=['block verification stopping at height', '(no data)']): with self.nodes[2].assert_debug_log(expected_msgs=["Block verification stopping at height", "(no data)"]):
assert not self.nodes[2].verifychain(checklevel=4, nblocks=0) assert not self.nodes[2].verifychain(checklevel=4, nblocks=0)
self.log.info(f"Will need to redownload block {self.forkheight}") self.log.info(f"Will need to redownload block {self.forkheight}")