log: [refactor] Use info level for init logs

This refactor does not change behavior.
This commit is contained in:
MarcoFalke
2025-07-25 09:52:43 +02:00
parent fa183761cb
commit face8123fd
27 changed files with 106 additions and 102 deletions

View File

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

View File

@@ -96,7 +96,8 @@ void ReadRegTestArgs(const ArgsManager& args, CChainParams::RegTestOptions& opti
if (vDeploymentParams[0] == VersionBitsDeploymentInfo[j].name) {
options.version_bits_parameters[Consensus::DeploymentPos(j)] = vbparams;
found = true;
LogPrintf("Setting version bits activation parameters for %s to start=%ld, timeout=%ld, min_activation_height=%d\n", vDeploymentParams[0], vbparams.start_time, vbparams.timeout, vbparams.min_activation_height);
LogInfo("Setting version bits activation parameters for %s to start=%ld, timeout=%ld, min_activation_height=%d",
vDeploymentParams[0], vbparams.start_time, vbparams.timeout, vbparams.min_activation_height);
break;
}
}

View File

@@ -228,12 +228,12 @@ CDBWrapper::CDBWrapper(const DBParams& params)
DBContext().options.env = DBContext().penv;
} else {
if (params.wipe_data) {
LogPrintf("Wiping LevelDB in %s\n", fs::PathToString(params.path));
LogInfo("Wiping LevelDB in %s", fs::PathToString(params.path));
leveldb::Status result = leveldb::DestroyDB(fs::PathToString(params.path), DBContext().options);
HandleError(result);
}
TryCreateDirectories(params.path);
LogPrintf("Opening LevelDB in %s\n", fs::PathToString(params.path));
LogInfo("Opening LevelDB in %s", fs::PathToString(params.path));
}
// PathToString() return value is safe to pass to leveldb open function,
// because on POSIX leveldb passes the byte string directly to ::open(), and
@@ -241,12 +241,12 @@ CDBWrapper::CDBWrapper(const DBParams& params)
// (see env_posix.cc and env_windows.cc).
leveldb::Status status = leveldb::DB::Open(DBContext().options, fs::PathToString(params.path), &DBContext().pdb);
HandleError(status);
LogPrintf("Opened LevelDB successfully\n");
LogInfo("Opened LevelDB successfully");
if (params.options.force_compact) {
LogPrintf("Starting database compaction of %s\n", fs::PathToString(params.path));
LogInfo("Starting database compaction of %s", fs::PathToString(params.path));
DBContext().pdb->CompactRange(nullptr, nullptr);
LogPrintf("Finished database compaction of %s\n", fs::PathToString(params.path));
LogInfo("Finished database compaction of %s", fs::PathToString(params.path));
}
assert(!m_obfuscation); // Needed for unobfuscated Read()/Write() below

View File

@@ -21,7 +21,7 @@ public:
bool HasWalletSupport() const override {return false;}
void AddWalletOptions(ArgsManager& argsman) const override;
bool ParameterInteraction() const override {return true;}
void Construct(node::NodeContext& node) const override {LogPrintf("No wallet support compiled in!\n");}
void Construct(node::NodeContext& node) const override { LogInfo("No wallet support compiled in!"); }
};
void DummyWalletInit::AddWalletOptions(ArgsManager& argsman) const

View File

@@ -391,7 +391,7 @@ static bool HTTPBindAddresses(struct evhttp* http)
// Bind addresses
for (std::vector<std::pair<std::string, uint16_t> >::iterator i = endpoints.begin(); i != endpoints.end(); ++i) {
LogPrintf("Binding RPC on address %s port %i\n", i->first, i->second);
LogInfo("Binding RPC on address %s port %i", i->first, i->second);
evhttp_bound_socket *bind_handle = evhttp_bind_socket_with_handle(http, i->first.empty() ? nullptr : i->first.c_str(), i->second);
if (bind_handle) {
const std::optional<CNetAddr> addr{LookupHost(i->first, false)};

View File

@@ -898,7 +898,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
// on the command line or in this chain's section of the config file.
ChainType chain = args.GetChainType();
if (chain == ChainType::SIGNET) {
LogPrintf("Signet derived magic (message start): %s\n", HexStr(chainparams.MessageStart()));
LogInfo("Signet derived magic (message start): %s", HexStr(chainparams.MessageStart()));
}
bilingual_str errors;
for (const auto& arg : args.GetUnsuitableSectionOnlyArgs()) {
@@ -1234,7 +1234,9 @@ static ChainstateLoadResult InitAndLoadChainstate(
if (!mempool_error.empty()) {
return {ChainstateLoadStatus::FAILURE_FATAL, mempool_error};
}
LogPrintf("* Using %.1f MiB for in-memory UTXO set (plus up to %.1f MiB of unused mempool space)\n", cache_sizes.coins * (1.0 / 1024 / 1024), mempool_opts.max_size_bytes * (1.0 / 1024 / 1024));
LogInfo("* Using %.1f MiB for in-memory UTXO set (plus up to %.1f MiB of unused mempool space)",
cache_sizes.coins * (1.0 / 1024 / 1024),
mempool_opts.max_size_bytes * (1.0 / 1024 / 1024));
ChainstateManager::Options chainman_opts{
.chainparams = chainparams,
.datadir = args.GetDataDirNet(),
@@ -1274,10 +1276,10 @@ static ChainstateLoadResult InitAndLoadChainstate(
// libbitcoinkernel.
chainman.snapshot_download_completed = [&node]() {
if (!node.chainman->m_blockman.IsPruneMode()) {
LogPrintf("[snapshot] re-enabling NODE_NETWORK services\n");
LogInfo("[snapshot] re-enabling NODE_NETWORK services");
node.connman->AddLocalServices(NODE_NETWORK);
}
LogPrintf("[snapshot] restarting indexes\n");
LogInfo("[snapshot] restarting indexes");
// Drain the validation interface queue to ensure that the old indexes
// don't have any pending work.
Assert(node.validation_signals)->SyncWithValidationInterfaceQueue();
@@ -1345,7 +1347,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
return false;
}
LogPrintf("Using at most %i automatic connections (%i file descriptors available)\n", nMaxConnections, available_fds);
LogInfo("Using at most %i automatic connections (%i file descriptors available)", nMaxConnections, available_fds);
// Warn about relative -datadir path.
if (args.IsArgSet("-datadir") && !args.GetPathArg("-datadir").is_absolute()) {
@@ -1402,7 +1404,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
} catch (const std::exception& e) {
return InitError(Untranslated(strprintf("Unable to bind to IPC address '%s'. %s", address, e.what())));
}
LogPrintf("Listening for IPC requests on address %s\n", address);
LogInfo("Listening for IPC requests on address %s", address);
}
}
@@ -1495,9 +1497,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
return false;
}
const uint256 asmap_version = (HashWriter{} << asmap).GetHash();
LogPrintf("Using asmap version %s for IP bucketing\n", asmap_version.ToString());
LogInfo("Using asmap version %s for IP bucketing", asmap_version.ToString());
} else {
LogPrintf("Using /16 prefix for IP bucketing\n");
LogInfo("Using /16 prefix for IP bucketing");
}
// Initialize netgroup manager
@@ -1753,7 +1755,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
// As LoadBlockIndex can take several minutes, it's possible the user
// requested to kill the GUI during the last operation. If so, exit.
if (ShutdownRequested(node)) {
LogPrintf("Shutdown requested. Exiting.\n");
LogInfo("Shutdown requested. Exiting.");
return false;
}
@@ -1808,10 +1810,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
} else {
// Prior to setting NODE_NETWORK, check if we can provide historical blocks.
if (!WITH_LOCK(chainman.GetMutex(), return chainman.BackgroundSyncInProgress())) {
LogPrintf("Setting NODE_NETWORK on non-prune mode\n");
LogInfo("Setting NODE_NETWORK on non-prune mode");
g_local_services = ServiceFlags(g_local_services | NODE_NETWORK);
} else {
LogPrintf("Running node in NODE_NETWORK_LIMITED mode until snapshot background sync completes\n");
LogInfo("Running node in NODE_NETWORK_LIMITED mode until snapshot background sync completes");
}
}
@@ -1870,7 +1872,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
// Import blocks and ActivateBestChain()
ImportBlocks(chainman, vImportFiles);
if (args.GetBoolArg("-stopafterblockimport", DEFAULT_STOPAFTERBLOCKIMPORT)) {
LogPrintf("Stopping after block import\n");
LogInfo("Stopping after block import");
if (!(Assert(node.shutdown_request))()) {
LogError("Failed to send shutdown signal after finishing block import\n");
}
@@ -1918,7 +1920,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
{
LOCK(chainman.GetMutex());
const auto& tip{*Assert(chainman.ActiveTip())};
LogPrintf("block tree size = %u\n", chainman.BlockIndex().size());
LogInfo("block tree size = %u", chainman.BlockIndex().size());
chain_active_height = tip.nHeight;
best_block_time = tip.GetBlockTime();
if (tip_info) {
@@ -1931,7 +1933,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
tip_info->header_time = chainman.m_best_header->GetBlockTime();
}
}
LogPrintf("nBestHeight = %d\n", chain_active_height);
LogInfo("nBestHeight = %d", chain_active_height);
if (node.peerman) node.peerman->SetBestBlock(chain_active_height, std::chrono::seconds{best_block_time});
// Map ports with NAT-PMP
@@ -2061,11 +2063,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
connOptions.m_specified_outgoing = connect;
}
if (!connOptions.m_specified_outgoing.empty() && !connOptions.vSeedNodes.empty()) {
LogPrintf("-seednode is ignored when -connect is used\n");
LogInfo("-seednode is ignored when -connect is used");
}
if (args.IsArgSet("-dnsseed") && args.GetBoolArg("-dnsseed", DEFAULT_DNSSEED) && args.IsArgSet("-proxy")) {
LogPrintf("-dnsseed is ignored when -connect is used and -proxy is specified\n");
LogInfo("-dnsseed is ignored when -connect is used and -proxy is specified");
}
}

View File

@@ -115,10 +115,10 @@ bool StartLogging(const ArgsManager& args)
}
if (!LogInstance().m_log_timestamps) {
LogPrintf("Startup time: %s\n", FormatISO8601DateTime(GetTime()));
LogInfo("Startup time: %s", FormatISO8601DateTime(GetTime()));
}
LogPrintf("Default data directory %s\n", fs::PathToString(GetDefaultDataDir()));
LogPrintf("Using data directory %s\n", fs::PathToString(gArgs.GetDataDirNet()));
LogInfo("Default data directory %s", fs::PathToString(GetDefaultDataDir()));
LogInfo("Using data directory %s", fs::PathToString(gArgs.GetDataDirNet()));
// Only log conf file usage message if conf file actually exists.
fs::path config_file_path = args.GetConfigFilePath();
@@ -127,12 +127,12 @@ bool StartLogging(const ArgsManager& args)
} else if (fs::is_directory(config_file_path)) {
LogWarning("Config file: %s (is directory, not file)", fs::PathToString(config_file_path));
} else if (fs::exists(config_file_path)) {
LogPrintf("Config file: %s\n", fs::PathToString(config_file_path));
LogInfo("Config file: %s", fs::PathToString(config_file_path));
} else if (args.IsArgSet("-conf")) {
InitWarning(strprintf(_("The specified config file %s does not exist"), fs::PathToString(config_file_path)));
} else {
// Not categorizing as "Warning" because it's the default behavior
LogPrintf("Config file: %s (not found, skipping)\n", fs::PathToString(config_file_path));
LogInfo("Config file: %s (not found, skipping)", fs::PathToString(config_file_path));
}
// Log the config arguments to debug.log
@@ -149,6 +149,6 @@ void LogPackageVersion()
#else
version_string += " (release build)";
#endif
LogPrintf(CLIENT_NAME " version %s\n", version_string);
LogInfo(CLIENT_NAME " version %s", version_string);
}
} // namespace init

View File

@@ -423,7 +423,7 @@ public:
0,
0,
};
LogPrintf("Signet with challenge %s\n", HexStr(bin));
LogInfo("Signet with challenge %s", HexStr(bin));
}
if (options.seeds) {

View File

@@ -298,7 +298,7 @@ void BlockManager::FindFilesToPruneManual(
setFilesToPrune.insert(fileNumber);
count++;
}
LogPrintf("[%s] Prune (Manual): prune_height=%d removed %d blk/rev pairs\n",
LogInfo("[%s] Prune (Manual): prune_height=%d removed %d blk/rev pairs",
chain.GetRole(), last_block_can_prune, count);
}
@@ -418,7 +418,7 @@ bool BlockManager::LoadBlockIndex(const std::optional<uint256>& snapshot_blockha
// to disk, we must bootstrap the value for assumedvalid chainstates
// from the hardcoded assumeutxo chainparams.
base->m_chain_tx_count = au_data.m_chain_tx_count;
LogPrintf("[snapshot] set m_chain_tx_count=%d for %s\n", au_data.m_chain_tx_count, snapshot_blockhash->ToString());
LogInfo("[snapshot] set m_chain_tx_count=%d for %s", au_data.m_chain_tx_count, snapshot_blockhash->ToString());
} else {
// If this isn't called with a snapshot blockhash, make sure the cached snapshot height
// is null. This is relevant during snapshot completion, when the blockman may be loaded
@@ -523,7 +523,7 @@ bool BlockManager::LoadBlockIndexDB(const std::optional<uint256>& snapshot_block
}
// Check presence of blk files
LogPrintf("Checking all blk files are present...\n");
LogInfo("Checking all blk files are present...");
std::set<int> setBlkDataFiles;
for (const auto& [_, block_index] : m_block_index) {
if (block_index.nStatus & BLOCK_HAVE_DATA) {
@@ -622,7 +622,7 @@ void BlockManager::CleanupBlockRevFiles() const
// Glob all blk?????.dat and rev?????.dat files from the blocks directory.
// Remove the rev files immediately and insert the blk file paths into an
// ordered map keyed by block file index.
LogPrintf("Removing unusable blk?????.dat and rev?????.dat files for -reindex with -prune\n");
LogInfo("Removing unusable blk?????.dat and rev?????.dat files for -reindex with -prune");
for (fs::directory_iterator it(m_opts.blocks_dir); it != fs::directory_iterator(); it++) {
const std::string path = fs::PathToString(it->path().filename());
if (fs::is_regular_file(*it) &&
@@ -1233,7 +1233,7 @@ void ImportBlocks(ChainstateManager& chainman, std::span<const fs::path> import_
if (file.IsNull()) {
break; // This error is logged in OpenBlockFile
}
LogPrintf("Reindexing block file blk%05u.dat...\n", (unsigned int)nFile);
LogInfo("Reindexing block file blk%05u.dat...", (unsigned int)nFile);
chainman.LoadExternalBlockFile(file, &pos, &blocks_with_unknown_parent);
if (chainman.m_interrupt) {
LogInfo("Interrupt requested. Exit reindexing.");
@@ -1243,7 +1243,7 @@ void ImportBlocks(ChainstateManager& chainman, std::span<const fs::path> import_
}
WITH_LOCK(::cs_main, chainman.m_blockman.m_block_tree_db->WriteReindexing(false));
chainman.m_blockman.m_blockfiles_indexed = true;
LogPrintf("Reindexing finished\n");
LogInfo("Reindexing finished");
// To avoid ending up in a situation without genesis block, re-try initializing (no-op if reindexing worked):
chainman.ActiveChainstate().LoadGenesisBlock();
}
@@ -1252,7 +1252,7 @@ void ImportBlocks(ChainstateManager& chainman, std::span<const fs::path> import_
for (const fs::path& path : import_paths) {
AutoFile file{fsbridge::fopen(path, "rb")};
if (!file.IsNull()) {
LogPrintf("Importing blocks file %s...\n", fs::PathToString(path));
LogInfo("Importing blocks file %s...", fs::PathToString(path));
chainman.LoadExternalBlockFile(file);
if (chainman.m_interrupt) {
LogInfo("Interrupt requested. Exit block importing.");

View File

@@ -84,7 +84,7 @@ static ChainstateLoadResult CompleteChainstateInitialization(
// block tree into BlockIndex()!
for (Chainstate* chainstate : chainman.GetAll()) {
LogPrintf("Initializing chainstate %s\n", chainstate->ToString());
LogInfo("Initializing chainstate %s", chainstate->ToString());
try {
chainstate->InitCoinsDB(
@@ -145,18 +145,19 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
const ChainstateLoadOptions& options)
{
if (!chainman.AssumedValidBlock().IsNull()) {
LogPrintf("Assuming ancestors of block %s have valid signatures.\n", chainman.AssumedValidBlock().GetHex());
LogInfo("Assuming ancestors of block %s have valid signatures.", chainman.AssumedValidBlock().GetHex());
} else {
LogPrintf("Validating signatures for all blocks.\n");
LogInfo("Validating signatures for all blocks.");
}
LogPrintf("Setting nMinimumChainWork=%s\n", chainman.MinimumChainWork().GetHex());
LogInfo("Setting nMinimumChainWork=%s", chainman.MinimumChainWork().GetHex());
if (chainman.MinimumChainWork() < UintToArith256(chainman.GetConsensus().nMinimumChainWork)) {
LogPrintf("Warning: nMinimumChainWork set below default value of %s\n", chainman.GetConsensus().nMinimumChainWork.GetHex());
}
if (chainman.m_blockman.GetPruneTarget() == BlockManager::PRUNE_TARGET_MANUAL) {
LogInfo("Block pruning enabled. Use RPC call pruneblockchain(height) to manually prune block and undo files.");
} 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);
LogInfo("Prune configured to target %u MiB on disk for block and undo files.",
chainman.m_blockman.GetPruneTarget() / 1024 / 1024);
}
LOCK(cs_main);
@@ -171,7 +172,7 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
bool has_snapshot = chainman.DetectSnapshotChainstate();
if (has_snapshot && options.wipe_chainstate_db) {
LogPrintf("[snapshot] deleting snapshot chainstate due to reindexing\n");
LogInfo("[snapshot] deleting snapshot chainstate due to reindexing");
if (!chainman.DeleteSnapshotChainstate()) {
return {ChainstateLoadStatus::FAILURE_FATAL, Untranslated("Couldn't remove snapshot chainstate.")};
}
@@ -195,7 +196,7 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
if (snapshot_completion == SnapshotCompletionResult::SKIPPED) {
// do nothing; expected case
} else if (snapshot_completion == SnapshotCompletionResult::SUCCESS) {
LogPrintf("[snapshot] cleaning up unneeded background chainstate, then reinitializing\n");
LogInfo("[snapshot] cleaning up unneeded background chainstate, then reinitializing");
if (!chainman.ValidatedSnapshotCleanup()) {
return {ChainstateLoadStatus::FAILURE_FATAL, Untranslated("Background chainstate cleanup failed unexpectedly.")};
}

View File

@@ -75,7 +75,7 @@ util::Result<void> ApplyArgsManOptions(const ArgsManager& argsman, const CChainP
} else if (mempool_opts.incremental_relay_feerate > mempool_opts.min_relay_feerate) {
// Allow only setting incremental fee to control both
mempool_opts.min_relay_feerate = mempool_opts.incremental_relay_feerate;
LogPrintf("Increasing minrelaytxfee to %s to match incrementalrelayfee\n", mempool_opts.min_relay_feerate.ToString());
LogInfo("Increasing minrelaytxfee to %s to match incrementalrelayfee", mempool_opts.min_relay_feerate.ToString());
}
// Feerate used to define dust. Shouldn't be changed lightly as old

View File

@@ -53,7 +53,7 @@ uint32_t FindBestImplementation()
}
}
assert(best.has_value());
LogPrintf("Using Minisketch implementation number %i\n", best->second);
LogInfo("Using Minisketch implementation number %i", best->second);
return best->second;
}

View File

@@ -54,7 +54,7 @@ bool noui_ThreadSafeQuestion(const bilingual_str& /* ignored interactive message
void noui_InitMessage(const std::string& message)
{
LogPrintf("init message: %s\n", message);
LogInfo("init message: %s", message);
}
void noui_connect()
@@ -66,19 +66,19 @@ void noui_connect()
bool noui_ThreadSafeMessageBoxRedirect(const bilingual_str& message, const std::string& caption, unsigned int style)
{
LogPrintf("%s: %s\n", caption, message.original);
LogInfo("%s: %s", caption, message.original);
return false;
}
bool noui_ThreadSafeQuestionRedirect(const bilingual_str& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style)
{
LogPrintf("%s: %s\n", caption, message);
LogInfo("%s: %s", caption, message);
return false;
}
void noui_InitMessageRedirect(const std::string& message)
{
LogPrintf("init message: %s\n", message);
LogInfo("init message: %s", message);
}
void noui_test_redirect()

View File

@@ -19,7 +19,7 @@ void noui_InitMessage(const std::string& message);
/** Connect all bitcoind signal handlers */
void noui_connect();
/** Redirect all bitcoind signal handlers to LogPrintf. Used to check or suppress output during test runs that produce expected errors */
/** Redirect all bitcoind signal handlers to LogInfo. Used to check or suppress output during test runs that produce expected errors */
void noui_test_redirect();
/** Reconnects the regular Non-GUI handlers after having used noui_test_redirect */

View File

@@ -561,7 +561,7 @@ CBlockPolicyEstimator::CBlockPolicyEstimator(const fs::path& estimation_filepath
AutoFile est_file{fsbridge::fopen(m_estimation_filepath, "rb")};
if (est_file.IsNull()) {
LogPrintf("%s is not found. Continue anyway.\n", fs::PathToString(m_estimation_filepath));
LogInfo("%s is not found. Continue anyway.", fs::PathToString(m_estimation_filepath));
return;
}
@@ -971,7 +971,7 @@ void CBlockPolicyEstimator::FlushFeeEstimates()
LogError("Failed to close fee estimates file %s: %s. Continuing anyway.", fs::PathToString(m_estimation_filepath), SysErrorString(errno));
return;
}
LogPrintf("Flushed fee estimates to %s.\n", fs::PathToString(m_estimation_filepath.filename()));
LogInfo("Flushed fee estimates to %s.", fs::PathToString(m_estimation_filepath.filename()));
}
bool CBlockPolicyEstimator::Write(AutoFile& fileout) const

View File

@@ -190,7 +190,7 @@ void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, cons
if (type == QtDebugMsg) {
LogDebug(BCLog::QT, "GUI: %s\n", msg.toStdString());
} else {
LogPrintf("GUI: %s\n", msg.toStdString());
LogInfo("GUI: %s", msg.toStdString());
}
}

View File

@@ -107,10 +107,10 @@ void ReportHardwareRand()
// This must be done in a separate function, as InitHardwareRand() may be indirectly called
// from global constructors, before logging is initialized.
if (g_rdseed_supported) {
LogPrintf("Using RdSeed as an additional entropy source\n");
LogInfo("Using RdSeed as an additional entropy source");
}
if (g_rdrand_supported) {
LogPrintf("Using RdRand as an additional entropy source\n");
LogInfo("Using RdRand as an additional entropy source");
}
}

View File

@@ -32,7 +32,7 @@ SignatureCache::SignatureCache(const size_t max_size_bytes)
m_salted_hasher_schnorr.Write(PADDING_SCHNORR, 32);
const auto [num_elems, approx_size_bytes] = setValid.setup_bytes(max_size_bytes);
LogPrintf("Using %zu MiB out of %zu MiB requested for signature cache, able to store %zu elements\n",
LogInfo("Using %zu MiB out of %zu MiB requested for signature cache, able to store %zu elements",
approx_size_bytes >> 20, max_size_bytes >> 20, num_elems);
}

View File

@@ -57,7 +57,7 @@ void IpcPipeTest()
std::promise<std::unique_ptr<mp::ProxyClient<gen::FooInterface>>> foo_promise;
std::function<void()> disconnect_client;
std::thread thread([&]() {
mp::EventLoop loop("IpcPipeTest", [](bool raise, const std::string& log) { LogPrintf("LOG%i: %s\n", raise, log); });
mp::EventLoop loop("IpcPipeTest", [](bool raise, const std::string& log) { LogInfo("LOG%i: %s", raise, log); });
auto pipe = loop.m_io_context.provider->newTwoWayPipe();
auto connection_client = std::make_unique<mp::Connection>(loop, kj::mv(pipe.ends[0]));

View File

@@ -74,7 +74,7 @@ struct LogSetup : public BasicTestingSetup {
~LogSetup()
{
LogInstance().m_file_path = prev_log_path;
LogPrintf("Sentinel log to reopen log file\n");
LogInfo("Sentinel log to reopen log file");
LogInstance().m_print_to_file = prev_print_to_file;
LogInstance().m_reopen_file = prev_reopen_file;
LogInstance().m_log_timestamps = prev_log_timestamps;

View File

@@ -52,8 +52,8 @@ CreateAndActivateUTXOSnapshot(
std::move(auto_outfile), // Will close auto_outfile.
snapshot_path,
snapshot_path);
LogPrintf(
"Wrote UTXO snapshot to %s: %s\n", fs::PathToString(snapshot_path.make_preferred()), result.write());
LogInfo("Wrote UTXO snapshot to %s: %s",
fs::PathToString(snapshot_path.make_preferred()), result.write());
// Read the written snapshot in and then activate it.
//

View File

@@ -205,7 +205,7 @@ std::vector<bool> DecodeAsmap(fs::path path)
}
file.seek(0, SEEK_END);
int length = file.tell();
LogPrintf("Opened asmap file %s (%d bytes) from disk\n", fs::quoted(fs::PathToString(path)), length);
LogInfo("Opened asmap file %s (%d bytes) from disk", fs::quoted(fs::PathToString(path)), length);
file.seek(0, SEEK_SET);
uint8_t cur_byte;
for (int i = 0; i < length; ++i) {

View File

@@ -17,9 +17,9 @@ void util::TraceThread(std::string_view thread_name, std::function<void()> threa
{
util::ThreadRename(std::string{thread_name});
try {
LogPrintf("%s thread start\n", thread_name);
LogInfo("%s thread start", thread_name);
thread_func();
LogPrintf("%s thread exit\n", thread_name);
LogInfo("%s thread exit", thread_name);
} catch (const std::exception& e) {
PrintExceptionContinue(&e, thread_name);
throw;

View File

@@ -2035,7 +2035,7 @@ bool ChainstateManager::IsInitialBlockDownload() const
if (chain.Tip()->Time() < Now<NodeSeconds>() - m_options.max_tip_age) {
return true;
}
LogPrintf("Leaving InitialBlockDownload (latching to false)\n");
LogInfo("Leaving InitialBlockDownload (latching to false)");
m_cached_finished_ibd.store(true, std::memory_order_relaxed);
return false;
}
@@ -2136,7 +2136,7 @@ ValidationCache::ValidationCache(const size_t script_execution_cache_bytes, cons
m_script_execution_cache_hasher.Write(nonce.begin(), 32);
const auto [num_elems, approx_size_bytes] = m_script_execution_cache.setup_bytes(script_execution_cache_bytes);
LogPrintf("Using %zu MiB out of %zu MiB requested for script execution cache, able to store %zu elements\n",
LogInfo("Using %zu MiB out of %zu MiB requested for script execution cache, able to store %zu elements",
approx_size_bytes >> 20, script_execution_cache_bytes >> 20, num_elems);
}
@@ -4695,7 +4695,7 @@ bool Chainstate::LoadChainTip()
PruneBlockIndexCandidates();
tip = m_chain.Tip();
LogPrintf("Loaded best chain: hashBestChain=%s height=%d date=%s progress=%f\n",
LogInfo("Loaded best chain: hashBestChain=%s height=%d date=%s progress=%f",
tip->GetBlockHash().ToString(),
m_chain.Height(),
FormatISO8601DateTime(tip->GetBlockTime()),
@@ -4741,7 +4741,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
nCheckDepth = chainstate.m_chain.Height();
}
nCheckLevel = std::max(0, std::min(4, nCheckLevel));
LogPrintf("Verifying last %i blocks at level %i\n", nCheckDepth, nCheckLevel);
LogInfo("Verifying last %i blocks at level %i", nCheckDepth, nCheckLevel);
CCoinsViewCache coins(&coinsview);
CBlockIndex* pindex;
CBlockIndex* pindexFailure = nullptr;
@@ -4750,7 +4750,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
int reportDone = 0;
bool skipped_no_block_data{false};
bool skipped_l3_checks{false};
LogPrintf("Verification progress: 0%%\n");
LogInfo("Verification progress: 0%%");
const bool is_snapshot_cs{chainstate.m_from_snapshot_blockhash};
@@ -4758,7 +4758,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
const int percentageDone = std::max(1, std::min(99, (int)(((double)(chainstate.m_chain.Height() - pindex->nHeight)) / (double)nCheckDepth * (nCheckLevel >= 4 ? 50 : 100))));
if (reportDone < percentageDone / 10) {
// report every 10% step
LogPrintf("Verification progress: %d%%\n", percentageDone);
LogInfo("Verification progress: %d%%", percentageDone);
reportDone = percentageDone / 10;
}
m_notifications.progress(_("Verifying blocks…"), percentageDone, false);
@@ -4834,7 +4834,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
const int percentageDone = std::max(1, std::min(99, 100 - (int)(((double)(chainstate.m_chain.Height() - pindex->nHeight)) / (double)nCheckDepth * 50)));
if (reportDone < percentageDone / 10) {
// report every 10% step
LogPrintf("Verification progress: %d%%\n", percentageDone);
LogInfo("Verification progress: %d%%", percentageDone);
reportDone = percentageDone / 10;
}
m_notifications.progress(_("Verifying blocks…"), percentageDone, false);
@@ -4852,7 +4852,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
}
}
LogPrintf("Verification: No coin database inconsistencies in last %i blocks (%i transactions)\n", block_count, nGoodTransactions);
LogInfo("Verification: No coin database inconsistencies in last %i blocks (%i transactions)", block_count, nGoodTransactions);
if (skipped_l3_checks) {
return VerifyDBResult::SKIPPED_L3_CHECKS;
@@ -4901,7 +4901,7 @@ bool Chainstate::ReplayBlocks()
}
m_chainman.GetNotifications().progress(_("Replaying blocks…"), 0, false);
LogPrintf("Replaying blocks\n");
LogInfo("Replaying blocks");
const CBlockIndex* pindexOld = nullptr; // Old tip during the interrupted flush.
const CBlockIndex* pindexNew; // New tip during the interrupted flush.
@@ -4931,7 +4931,7 @@ bool Chainstate::ReplayBlocks()
LogError("RollbackBlock(): ReadBlock() failed at %d, hash=%s\n", pindexOld->nHeight, pindexOld->GetBlockHash().ToString());
return false;
}
LogPrintf("Rolling back %s (%i)\n", pindexOld->GetBlockHash().ToString(), pindexOld->nHeight);
LogInfo("Rolling back %s (%i)", pindexOld->GetBlockHash().ToString(), pindexOld->nHeight);
DisconnectResult res = DisconnectBlock(block, pindexOld, cache);
if (res == DISCONNECT_FAILED) {
LogError("RollbackBlock(): DisconnectBlock failed at %d, hash=%s\n", pindexOld->nHeight, pindexOld->GetBlockHash().ToString());
@@ -4950,7 +4950,7 @@ bool Chainstate::ReplayBlocks()
for (int nHeight = nForkHeight + 1; nHeight <= pindexNew->nHeight; ++nHeight) {
const CBlockIndex& pindex{*Assert(pindexNew->GetAncestor(nHeight))};
LogPrintf("Rolling forward %s (%i)\n", pindex.GetBlockHash().ToString(), nHeight);
LogInfo("Rolling forward %s (%i)", pindex.GetBlockHash().ToString(), nHeight);
m_chainman.GetNotifications().progress(_("Replaying blocks…"), (int)((nHeight - nForkHeight) * 100.0 / (pindexNew->nHeight - nForkHeight)), false);
if (!RollforwardBlock(&pindex, cache)) return false;
}
@@ -5228,7 +5228,7 @@ void ChainstateManager::LoadExternalBlockFile(
} catch (const std::runtime_error& e) {
GetNotifications().fatalError(strprintf(_("System error while loading external block file: %s"), e.what()));
}
LogPrintf("Loaded %i blocks from external file in %dms\n", nLoaded, Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
LogInfo("Loaded %i blocks from external file in %dms", nLoaded, Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
}
bool ChainstateManager::ShouldCheckBlockIndex() const
@@ -5578,9 +5578,9 @@ bool Chainstate::ResizeCoinsCaches(size_t coinstip_size, size_t coinsdb_size)
m_coinsdb_cache_size_bytes = coinsdb_size;
CoinsDB().ResizeCache(coinsdb_size);
LogPrintf("[%s] resized coinsdb cache to %.1f MiB\n",
LogInfo("[%s] resized coinsdb cache to %.1f MiB",
this->ToString(), coinsdb_size * (1.0 / 1024 / 1024));
LogPrintf("[%s] resized coinstip cache to %.1f MiB\n",
LogInfo("[%s] resized coinstip cache to %.1f MiB",
this->ToString(), coinstip_size * (1.0 / 1024 / 1024));
BlockValidationState state;
@@ -5687,7 +5687,7 @@ Chainstate& ChainstateManager::InitializeChainstate(CTxMemPool* mempool)
}
std::string path_str = fs::PathToString(db_path);
LogPrintf("Removing leveldb dir at %s\n", path_str);
LogInfo("Removing leveldb dir at %s\n", path_str);
// We have to destruct before this call leveldb::DB in order to release the db
// lock, otherwise `DestroyDB` will fail. See `leveldb::~DBImpl()`.
@@ -5850,8 +5850,8 @@ util::Result<CBlockIndex*> ChainstateManager::ActivateSnapshot(
m_active_chainstate = m_snapshot_chainstate.get();
m_blockman.m_snapshot_height = this->GetSnapshotBaseHeight();
LogPrintf("[snapshot] successfully activated snapshot %s\n", base_blockhash.ToString());
LogPrintf("[snapshot] (%.2f MB)\n",
LogInfo("[snapshot] successfully activated snapshot %s", base_blockhash.ToString());
LogInfo("[snapshot] (%.2f MB)",
m_snapshot_chainstate->CoinsTip().DynamicMemoryUsage() / (1000 * 1000));
this->MaybeRebalanceCaches();
@@ -5922,7 +5922,7 @@ util::Result<void> ChainstateManager::PopulateAndValidateSnapshot(
const uint64_t coins_count = metadata.m_coins_count;
uint64_t coins_left = metadata.m_coins_count;
LogPrintf("[snapshot] loading %d coins from snapshot %s\n", coins_left, base_blockhash.ToString());
LogInfo("[snapshot] loading %d coins from snapshot %s", coins_left, base_blockhash.ToString());
int64_t coins_processed{0};
while (coins_left > 0) {
@@ -5958,7 +5958,7 @@ util::Result<void> ChainstateManager::PopulateAndValidateSnapshot(
++coins_processed;
if (coins_processed % 1000000 == 0) {
LogPrintf("[snapshot] %d coins loaded (%.2f%%, %.2f MB)\n",
LogInfo("[snapshot] %d coins loaded (%.2f%%, %.2f MB)",
coins_processed,
static_cast<float>(coins_processed) * 100 / static_cast<float>(coins_count),
coins_cache.DynamicMemoryUsage() / (1000 * 1000));
@@ -6013,7 +6013,7 @@ util::Result<void> ChainstateManager::PopulateAndValidateSnapshot(
coins_count))};
}
LogPrintf("[snapshot] loaded %d (%.2f MB) coins from snapshot %s\n",
LogInfo("[snapshot] loaded %d (%.2f MB) coins from snapshot %s",
coins_count,
coins_cache.DynamicMemoryUsage() / (1000 * 1000),
base_blockhash.ToString());
@@ -6080,7 +6080,7 @@ util::Result<void> ChainstateManager::PopulateAndValidateSnapshot(
index->m_chain_tx_count = au_data.m_chain_tx_count;
snapshot_chainstate.setBlockIndexCandidates.insert(snapshot_start_block);
LogPrintf("[snapshot] validated snapshot (%.2f MB)\n",
LogInfo("[snapshot] validated snapshot (%.2f MB)",
coins_cache.DynamicMemoryUsage() / (1000 * 1000));
return {};
}
@@ -6184,8 +6184,8 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation()
const AssumeutxoData& au_data = *maybe_au_data;
std::optional<CCoinsStats> maybe_ibd_stats;
LogPrintf("[snapshot] computing UTXO stats for background chainstate to validate "
"snapshot - this could take a few minutes\n");
LogInfo("[snapshot] computing UTXO stats for background chainstate to validate "
"snapshot - this could take a few minutes");
try {
maybe_ibd_stats = ComputeUTXOStats(
CoinStatsHashType::HASH_SERIALIZED,
@@ -6221,7 +6221,7 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation()
return SnapshotCompletionResult::HASH_MISMATCH;
}
LogPrintf("[snapshot] snapshot beginning at %s has been fully validated\n",
LogInfo("[snapshot] snapshot beginning at %s has been fully validated",
snapshot_blockhash.ToString());
m_ibd_chainstate->m_disabled = true;
@@ -6257,7 +6257,7 @@ void ChainstateManager::MaybeRebalanceCaches()
}
else if (snapshot_usable && !ibd_usable) {
// If background validation has completed and snapshot is our active chain...
LogPrintf("[snapshot] allocating all cache to the snapshot chainstate\n");
LogInfo("[snapshot] allocating all cache to the snapshot chainstate");
// Allocate everything to the snapshot chainstate.
m_snapshot_chainstate->ResizeCoinsCaches(m_total_coinstip_cache, m_total_coinsdb_cache);
}
@@ -6326,7 +6326,7 @@ bool ChainstateManager::DetectSnapshotChainstate()
if (!base_blockhash) {
return false;
}
LogPrintf("[snapshot] detected active snapshot chainstate (%s) - loading\n",
LogInfo("[snapshot] detected active snapshot chainstate (%s) - loading",
fs::PathToString(*path));
this->ActivateExistingSnapshot(*base_blockhash);
@@ -6338,7 +6338,7 @@ Chainstate& ChainstateManager::ActivateExistingSnapshot(uint256 base_blockhash)
assert(!m_snapshot_chainstate);
m_snapshot_chainstate =
std::make_unique<Chainstate>(nullptr, m_blockman, *this, base_blockhash);
LogPrintf("[snapshot] switching active chainstate to %s\n", m_snapshot_chainstate->ToString());
LogInfo("[snapshot] switching active chainstate to %s", m_snapshot_chainstate->ToString());
// Mempool is empty at this point because we're still in IBD.
Assert(m_active_chainstate->m_mempool->size() == 0);
@@ -6382,7 +6382,7 @@ util::Result<void> Chainstate::InvalidateCoinsDBOnDisk()
auto invalid_path = snapshot_datadir + "_INVALID";
std::string dbpath = fs::PathToString(snapshot_datadir);
std::string target = fs::PathToString(invalid_path);
LogPrintf("[snapshot] renaming snapshot datadir %s to %s\n", dbpath, target);
LogInfo("[snapshot] renaming snapshot datadir %s to %s", dbpath, target);
// The invalid snapshot datadir is simply moved and not deleted because we may
// want to do forensics later during issue investigation. The user is instructed
@@ -6494,7 +6494,7 @@ bool ChainstateManager::ValidatedSnapshotCleanup()
// No chainstates should be considered usable.
assert(this->GetAll().size() == 0);
LogPrintf("[snapshot] deleting background chainstate directory (now unnecessary) (%s)\n",
LogInfo("[snapshot] deleting background chainstate directory (now unnecessary) (%s)",
fs::PathToString(ibd_chainstate_path));
fs::path tmp_old{ibd_chainstate_path + "_todelete"};
@@ -6518,8 +6518,8 @@ bool ChainstateManager::ValidatedSnapshotCleanup()
throw;
}
LogPrintf("[snapshot] moving snapshot chainstate (%s) to "
"default chainstate directory (%s)\n",
LogInfo("[snapshot] moving snapshot chainstate (%s) to "
"default chainstate directory (%s)",
fs::PathToString(snapshot_chainstate_path), fs::PathToString(ibd_chainstate_path));
try {
@@ -6536,7 +6536,7 @@ bool ChainstateManager::ValidatedSnapshotCleanup()
"directory is now unnecessary.\n",
fs::PathToString(tmp_old));
} else {
LogPrintf("[snapshot] deleted background chainstate directory (%s)\n",
LogInfo("[snapshot] deleted background chainstate directory (%s)",
fs::PathToString(ibd_chainstate_path));
}
return true;

View File

@@ -105,7 +105,7 @@ void WalletInit::Construct(NodeContext& node) const
{
ArgsManager& args = *Assert(node.args);
if (args.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) {
LogPrintf("Wallet disabled!\n");
LogInfo("Wallet disabled!");
return;
}
auto wallet_loader = node.init->makeWalletLoader(*node.chain);

View File

@@ -50,7 +50,7 @@ bool VerifyWallets(WalletContext& context)
args.ForceSetArg("-walletdir", fs::PathToString(canonical_wallet_dir));
}
LogPrintf("Using wallet directory %s\n", fs::PathToString(GetWalletDir()));
LogInfo("Using wallet directory %s", fs::PathToString(GetWalletDir()));
chain.initMessage(_("Verifying wallet(s)…"));

View File

@@ -116,8 +116,8 @@ SQLiteDatabase::SQLiteDatabase(const fs::path& dir_path, const fs::path& file_pa
{
{
LOCK(g_sqlite_mutex);
LogPrintf("Using SQLite Version %s\n", SQLiteDatabaseVersion());
LogPrintf("Using wallet %s\n", fs::PathToString(m_dir_path));
LogInfo("Using SQLite Version %s", SQLiteDatabaseVersion());
LogInfo("Using wallet %s", fs::PathToString(m_dir_path));
if (++g_sqlite_count == 1) {
// Setup logging