Skip to content

Commit 02f167e

Browse files
committed
Fix several LogPrint related variadic warnings from linter
1 parent 0863ea3 commit 02f167e

File tree

4 files changed

+37
-28
lines changed

4 files changed

+37
-28
lines changed

src/gridcoin/scraper/scraper_net.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,8 @@ EXCLUSIVE_LOCKS_REQUIRED(CScraperManifest::cs_mapManifest)
563563
iter->second)));
564564
if (!iter2.second)
565565
{
566-
LogPrint("WARN: %s: Manifest insertion attempt into pending deleted map failed because an entry with the same "
567-
"hash = %s, already exists. This should not happen.", __func__, nHash.GetHex());
566+
LogPrintf("WARN: %s: Manifest insertion attempt into pending deleted map failed because an entry with the same "
567+
"hash = %s, already exists. This should not happen.", __func__, nHash.GetHex());
568568
}
569569
else
570570
{
@@ -605,8 +605,8 @@ CScraperManifest::DeleteManifest(std::map<uint256, std::shared_ptr<CScraperManif
605605
iter->second)));
606606
if (!iter2.second)
607607
{
608-
LogPrint("WARN: %s: Manifest insertion attempt into pending deleted map failed because an entry with the same "
609-
"hash = %s, already exists. This should not happen.", __func__, iter->first.GetHex());
608+
LogPrintf("WARN: %s: Manifest insertion attempt into pending deleted map failed because an entry with the same "
609+
"hash = %s, already exists. This should not happen.", __func__, iter->first.GetHex());
610610
}
611611
else
612612
{

src/main.cpp

+26-18
Original file line numberDiff line numberDiff line change
@@ -3260,36 +3260,44 @@ void PrintBlockTree() EXCLUSIVE_LOCKS_REQUIRED(cs_main)
32603260
CBlockIndex* pindex = vStack.back().second;
32613261
vStack.pop_back();
32623262

3263+
std::stringstream output;
3264+
32633265
// print split or gap
32643266
if (nCol > nPrevCol)
32653267
{
3266-
for (int i = 0; i < nCol-1; i++)
3267-
LogPrintf("| ");
3268-
LogPrintf("|\\");
3268+
for (int i = 0; i < nCol-1; i++) {
3269+
output << "| \n";
3270+
}
3271+
3272+
output << "|\\\n";
32693273
}
32703274
else if (nCol < nPrevCol)
32713275
{
3272-
for (int i = 0; i < nCol; i++)
3273-
LogPrintf("| ");
3274-
LogPrintf("|");
3275-
}
3276+
for (int i = 0; i < nCol; i++) {
3277+
output << "| \n";
3278+
}
3279+
3280+
output << "|\n";
3281+
}
32763282
nPrevCol = nCol;
32773283

32783284
// print columns
3279-
for (int i = 0; i < nCol; i++)
3280-
LogPrintf("| ");
3285+
for (int i = 0; i < nCol; i++) {
3286+
output << "| \n";
3287+
}
32813288

3282-
// print item
3289+
// print item (and also prepend above formatting)
32833290
CBlock block;
32843291
ReadBlockFromDisk(block, pindex, Params().GetConsensus());
3285-
LogPrintf("%d (%u,%u) %s %08x %s tx %" PRIszu "",
3286-
pindex->nHeight,
3287-
pindex->nFile,
3288-
pindex->nBlockPos,
3289-
block.GetHash(true).ToString().c_str(),
3290-
block.nBits,
3291-
DateTimeStrFormat("%x %H:%M:%S", block.GetBlockTime()).c_str(),
3292-
block.vtx.size());
3292+
LogPrintf("%s%d (%u,%u) %s %08x %s tx %" PRIszu "",
3293+
output.str(),
3294+
pindex->nHeight,
3295+
pindex->nFile,
3296+
pindex->nBlockPos,
3297+
block.GetHash(true).ToString().c_str(),
3298+
block.nBits,
3299+
DateTimeStrFormat("%x %H:%M:%S", block.GetBlockTime()).c_str(),
3300+
block.vtx.size());
32933301

32943302
PrintWallets(block);
32953303

src/miner.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,8 @@ void SplitCoinStakeOutput(CBlock &blocknew, int64_t &nReward, bool &fEnableStake
934934

935935
if (dSumAllocation + iterSideStake->second > 1.0)
936936
{
937-
LogPrintf("WARN: SplitCoinStakeOutput: allocation percentage over 100\%, ending sidestake allocations.");
937+
LogPrintf("WARN: SplitCoinStakeOutput: allocation percentage over 100 percent, "
938+
"ending sidestake allocations.");
938939
break;
939940
}
940941

@@ -1327,7 +1328,7 @@ SideStakeAlloc GetSideStakingStatusAndAlloc()
13271328
dSumAllocation += dAllocation;
13281329
if (dSumAllocation > 1.0)
13291330
{
1330-
LogPrintf("WARN: %s: allocation percentage over 100\%, ending sidestake allocations.", __func__);
1331+
LogPrintf("WARN: %s: allocation percentage over 100 percent, ending sidestake allocations.", __func__);
13311332
break;
13321333
}
13331334

src/util/time.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ int64_t MilliTimer::GetStartTime(const std::string& label)
261261
internal_timer = timer_map.at(label);
262262
}
263263
catch (std::out_of_range&) {
264-
LogPrintf("WARNING: %s: Timer with specified label does not exist. Returning zero start time.");
264+
LogPrintf("WARNING: %s: Timer with specified label does not exist. Returning zero start time.", __func__);
265265
}
266266

267267
return internal_timer.start_time;
@@ -291,7 +291,7 @@ const MilliTimer::timer MilliTimer::GetTimes(const std::string& log_string, cons
291291
}
292292
catch (std::out_of_range&)
293293
{
294-
LogPrintf("WARNING: %s: Timer with specified label does not exist. Returning zeroed timer.");
294+
LogPrintf("WARNING: %s: Timer with specified label does not exist. Returning zeroed timer.", __func__);
295295
timer = {};
296296
return timer;
297297
}
@@ -300,8 +300,8 @@ const MilliTimer::timer MilliTimer::GetTimes(const std::string& log_string, cons
300300
// minimize lock time.
301301
if (internal_timer.log)
302302
{
303-
LogPrintf("timer %s: %s: elapsed time: %" PRId64 " ms, time since last check: %" PRId64 " ms.",
304-
label, log_string, timer.elapsed_time, timer.time_since_last_check);
303+
LogPrintf("INFO: %s: timer %s: %s: elapsed time: %" PRId64 " ms, time since last check: %" PRId64 " ms.",
304+
__func__, label, log_string, timer.elapsed_time, timer.time_since_last_check);
305305
}
306306

307307
return timer;

0 commit comments

Comments
 (0)