0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-05 14:06:27 -05:00

refactor: fix unterminated LogPrintf()s

This commit is contained in:
fanquake 2023-07-27 12:11:43 +01:00
parent 0a1029aa29
commit 7de23cceb8
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1
3 changed files with 6 additions and 6 deletions

View file

@ -83,10 +83,10 @@ BOOST_AUTO_TEST_CASE(logging_timer)
BOOST_FIXTURE_TEST_CASE(logging_LogPrintf_, LogSetup) BOOST_FIXTURE_TEST_CASE(logging_LogPrintf_, LogSetup)
{ {
LogInstance().m_log_sourcelocations = true; LogInstance().m_log_sourcelocations = true;
LogPrintf_("fn1", "src1", 1, BCLog::LogFlags::NET, BCLog::Level::Debug, "foo1: %s", "bar1\n"); LogPrintf_("fn1", "src1", 1, BCLog::LogFlags::NET, BCLog::Level::Debug, "foo1: %s\n", "bar1");
LogPrintf_("fn2", "src2", 2, BCLog::LogFlags::NET, BCLog::Level::None, "foo2: %s", "bar2\n"); LogPrintf_("fn2", "src2", 2, BCLog::LogFlags::NET, BCLog::Level::None, "foo2: %s\n", "bar2");
LogPrintf_("fn3", "src3", 3, BCLog::LogFlags::NONE, BCLog::Level::Debug, "foo3: %s", "bar3\n"); LogPrintf_("fn3", "src3", 3, BCLog::LogFlags::NONE, BCLog::Level::Debug, "foo3: %s\n", "bar3");
LogPrintf_("fn4", "src4", 4, BCLog::LogFlags::NONE, BCLog::Level::None, "foo4: %s", "bar4\n"); LogPrintf_("fn4", "src4", 4, BCLog::LogFlags::NONE, BCLog::Level::None, "foo4: %s\n", "bar4");
std::ifstream file{tmp_log_path}; std::ifstream file{tmp_log_path};
std::vector<std::string> log_lines; std::vector<std::string> log_lines;
for (std::string log; std::getline(file, log);) { for (std::string log; std::getline(file, log);) {

View file

@ -50,7 +50,7 @@ CreateAndActivateUTXOSnapshot(
UniValue result = CreateUTXOSnapshot( UniValue result = CreateUTXOSnapshot(
node, node.chainman->ActiveChainstate(), auto_outfile, snapshot_path, snapshot_path); node, node.chainman->ActiveChainstate(), auto_outfile, snapshot_path, snapshot_path);
LogPrintf( LogPrintf(
"Wrote UTXO snapshot to %s: %s", fs::PathToString(snapshot_path.make_preferred()), result.write()); "Wrote UTXO snapshot to %s: %s\n", fs::PathToString(snapshot_path.make_preferred()), result.write());
// Read the written snapshot in and then activate it. // Read the written snapshot in and then activate it.
// //

View file

@ -5474,7 +5474,7 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation()
if (index_new.GetBlockHash() != snapshot_blockhash) { if (index_new.GetBlockHash() != snapshot_blockhash) {
LogPrintf("[snapshot] supposed base block %s does not match the " LogPrintf("[snapshot] supposed base block %s does not match the "
"snapshot base block %s (height %d). Snapshot is not valid.", "snapshot base block %s (height %d). Snapshot is not valid.\n",
index_new.ToString(), snapshot_blockhash.ToString(), snapshot_base_height); index_new.ToString(), snapshot_blockhash.ToString(), snapshot_base_height);
handle_invalid_snapshot(); handle_invalid_snapshot();
return SnapshotCompletionResult::BASE_BLOCKHASH_MISMATCH; return SnapshotCompletionResult::BASE_BLOCKHASH_MISMATCH;