aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-05-02 15:56:30 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-05-02 15:56:58 +0200
commitef46c9904b80b1c47de4edac16b155f4de433437 (patch)
treee06dc43a0c8cc0c57343e5dc21474492d0f6640b
parent598db389c33e5e90783ef1223df2eeab095ed622 (diff)
parent4b75dcf0ec7beecc9a4638305d1beed9477ba06e (diff)
downloadbitcoin-ef46c9904b80b1c47de4edac16b155f4de433437.tar.xz
Merge #13153: Add missing newlines to debug logging
4b75dcf devtools: Make linter check LogPrint calls (MarcoFalke) ff2ad2d Add missing newlines to LogPrint debug logging (Wladimir J. van der Laan) Pull request description: ~~Don't we have a linter that should catch these?~~ Tree-SHA512: 1a58eca01ded9c1719e943c09447deeb59bb06dba00528cf460eefe857fdf95b42671fbdebc87cdd2f51e931e86942d06587ffd097cbb0d8dd9eb7a0ba17a8f0
-rwxr-xr-xcontrib/devtools/lint-logs.sh5
-rw-r--r--src/net.cpp2
-rw-r--r--src/net_processing.cpp4
-rw-r--r--src/rpc/blockchain.cpp2
-rw-r--r--src/timedata.cpp4
-rw-r--r--src/wallet/coinselection.cpp4
6 files changed, 11 insertions, 10 deletions
diff --git a/contrib/devtools/lint-logs.sh b/contrib/devtools/lint-logs.sh
index 3bb54359a8..35be13ec19 100755
--- a/contrib/devtools/lint-logs.sh
+++ b/contrib/devtools/lint-logs.sh
@@ -13,12 +13,13 @@
# ignored
-UNTERMINATED_LOGS=$(git grep "LogPrintf(" -- "*.cpp" | \
+UNTERMINATED_LOGS=$(git grep --extended-regexp "LogPrintf?\(" -- "*.cpp" | \
grep -v '\\n"' | \
grep -v "/\* Continued \*/" | \
+ grep -v "LogPrint()" | \
grep -v "LogPrintf()")
if [[ ${UNTERMINATED_LOGS} != "" ]]; then
- echo "All calls to LogPrintf() should be terminated with \\n"
+ echo "All calls to LogPrintf() and LogPrint() should be terminated with \\n"
echo
echo "${UNTERMINATED_LOGS}"
exit 1
diff --git a/src/net.cpp b/src/net.cpp
index cd076c1ce2..0a1e268822 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -395,7 +395,7 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo
if (Lookup(pszDest, resolved, default_port, fNameLookup && !HaveNameProxy(), 256) && !resolved.empty()) {
addrConnect = CAddress(resolved[GetRand(resolved.size())], NODE_NONE);
if (!addrConnect.IsValid()) {
- LogPrint(BCLog::NET, "Resolver returned invalid address %s for %s", addrConnect.ToString(), pszDest);
+ LogPrint(BCLog::NET, "Resolver returned invalid address %s for %s\n", addrConnect.ToString(), pszDest);
return nullptr;
}
// It is possible that we already have a connection to the IP/port pszDest resolved to.
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index ee4e9e61bc..cc819a01c3 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -2059,7 +2059,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
const CBlockIndex* pindex = LookupBlockIndex(req.blockhash);
if (!pindex || !(pindex->nStatus & BLOCK_HAVE_DATA)) {
- LogPrint(BCLog::NET, "Peer %d sent us a getblocktxn for a block we don't have", pfrom->GetId());
+ LogPrint(BCLog::NET, "Peer %d sent us a getblocktxn for a block we don't have\n", pfrom->GetId());
return true;
}
@@ -2071,7 +2071,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
// might maliciously send lots of getblocktxn requests to trigger
// expensive disk reads, because it will require the peer to
// actually receive all the data read from disk over the network.
- LogPrint(BCLog::NET, "Peer %d sent us a getblocktxn for a block > %i deep", pfrom->GetId(), MAX_BLOCKTXN_DEPTH);
+ LogPrint(BCLog::NET, "Peer %d sent us a getblocktxn for a block > %i deep\n", pfrom->GetId(), MAX_BLOCKTXN_DEPTH);
CInv inv;
inv.type = State(pfrom->GetId())->fWantsCmpctWitness ? MSG_WITNESS_BLOCK : MSG_BLOCK;
inv.hash = req.blockhash;
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index c24a3de060..5593cc9acc 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -940,7 +940,7 @@ UniValue pruneblockchain(const JSONRPCRequest& request)
else if (height > chainHeight)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Blockchain is shorter than the attempted prune height.");
else if (height > chainHeight - MIN_BLOCKS_TO_KEEP) {
- LogPrint(BCLog::RPC, "Attempt to prune blocks close to the tip. Retaining the minimum number of blocks.");
+ LogPrint(BCLog::RPC, "Attempt to prune blocks close to the tip. Retaining the minimum number of blocks.\n");
height = chainHeight - MIN_BLOCKS_TO_KEEP;
}
diff --git a/src/timedata.cpp b/src/timedata.cpp
index a803b2fc87..27d08172f5 100644
--- a/src/timedata.cpp
+++ b/src/timedata.cpp
@@ -110,9 +110,9 @@ void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample)
if (LogAcceptCategory(BCLog::NET)) {
for (int64_t n : vSorted) {
- LogPrint(BCLog::NET, "%+d ", n);
+ LogPrint(BCLog::NET, "%+d ", n); /* Continued */
}
- LogPrint(BCLog::NET, "| ");
+ LogPrint(BCLog::NET, "| "); /* Continued */
LogPrint(BCLog::NET, "nTimeOffset = %+d (%+d minutes)\n", nTimeOffset, nTimeOffset/60);
}
diff --git a/src/wallet/coinselection.cpp b/src/wallet/coinselection.cpp
index 8596ad2adc..a403411e5b 100644
--- a/src/wallet/coinselection.cpp
+++ b/src/wallet/coinselection.cpp
@@ -286,10 +286,10 @@ bool KnapsackSolver(const CAmount& nTargetValue, std::vector<CInputCoin>& vCoins
}
if (LogAcceptCategory(BCLog::SELECTCOINS)) {
- LogPrint(BCLog::SELECTCOINS, "SelectCoins() best subset: ");
+ LogPrint(BCLog::SELECTCOINS, "SelectCoins() best subset: "); /* Continued */
for (unsigned int i = 0; i < vValue.size(); i++) {
if (vfBest[i]) {
- LogPrint(BCLog::SELECTCOINS, "%s ", FormatMoney(vValue[i].txout.nValue));
+ LogPrint(BCLog::SELECTCOINS, "%s ", FormatMoney(vValue[i].txout.nValue)); /* Continued */
}
}
LogPrint(BCLog::SELECTCOINS, "total %s\n", FormatMoney(nBest));