Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
793c670
Contains dashification. disables `-debug dash`
PastaPastaPasta Apr 2, 2017
7c3056c
Merge #10123: Allow debug logs to be excluded from specified component
laanwj Apr 3, 2017
9d4a853
bump to uint64_t due to added Dash codes
PastaPastaPasta May 16, 2019
6d96c3e
bump to uint64_t due to added Dash codes cont.
PastaPastaPasta May 16, 2019
d86aa0f
string -> BCLog format
PastaPastaPasta May 16, 2019
f3b95ee
uint32_t -> uint64_t
PastaPastaPasta May 16, 2019
424fc41
Fix CBatchedLogger
UdjinM6 May 16, 2019
eaac520
Fix most fDebug-s
UdjinM6 May 16, 2019
9935e7f
Fix `debug` rpc
UdjinM6 May 16, 2019
fd067bf
Fix BENCH and RAND conflicts
UdjinM6 May 16, 2019
3d82bfa
Add ALERT and use it
UdjinM6 May 16, 2019
9a72d85
Update LogPrint-s in dash-specific code
UdjinM6 May 16, 2019
8459763
Tweak few log categories
UdjinM6 May 16, 2019
87ae8c9
Drop no longer used MASTERNODE category
UdjinM6 May 16, 2019
fcd39a3
Shift dash-specific log categories to start from `1ul << 32` to avoid…
UdjinM6 May 16, 2019
8f67fcc
Fix `dash` category
UdjinM6 May 16, 2019
4e5791c
Merge #10153: logging: Fix off-by-one for shrinkdebugfile default
laanwj Apr 5, 2017
96f3f64
remove debugCategories
PastaPastaPasta May 22, 2019
8998edf
Prepend "std::" to find call
codablock May 22, 2019
e696792
Check for BCLog::PRIVATESEND instead of logCategories != BCLog::NONE
codablock May 22, 2019
3b14196
Use BCLog::MNPAYMENTS category instead of checking for logCategories …
codablock May 22, 2019
e9a80f2
Move "End Dash" comment below "ALERT"
codablock May 22, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/addrman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ void CAddrMan::Good_(const CService& addr, int64_t nTime)
if (nUBucket == -1)
return;

LogPrint("addrman", "Moving %s to tried\n", addr.ToString());
LogPrint(BCLog::ADDRMAN, "Moving %s to tried\n", addr.ToString());

// move nId to the tried tables
MakeTried(info, nId);
Expand Down
12 changes: 7 additions & 5 deletions src/addrman.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ class CAddrMan
}
}
if (nLost + nLostUnk > 0) {
LogPrint("addrman", "addrman lost %i new and %i tried addresses due to collisions\n", nLostUnk, nLost);
LogPrint(BCLog::ADDRMAN, "addrman lost %i new and %i tried addresses due to collisions\n", nLostUnk, nLost);
}

Check();
Expand Down Expand Up @@ -511,8 +511,9 @@ class CAddrMan
Check();
fRet |= Add_(addr, source, nTimePenalty);
Check();
if (fRet)
LogPrint("addrman", "Added %s from %s: %i tried, %i new\n", addr.ToStringIPPort(), source.ToString(), nTried, nNew);
if (fRet) {
LogPrint(BCLog::ADDRMAN, "Added %s from %s: %i tried, %i new\n", addr.ToStringIPPort(), source.ToString(), nTried, nNew);
}
return fRet;
}

Expand All @@ -525,8 +526,9 @@ class CAddrMan
for (std::vector<CAddress>::const_iterator it = vAddr.begin(); it != vAddr.end(); it++)
nAdd += Add_(*it, source, nTimePenalty) ? 1 : 0;
Check();
if (nAdd)
LogPrint("addrman", "Added %i addresses from %s: %i tried, %i new\n", nAdd, source.ToString(), nTried, nNew);
if (nAdd) {
LogPrint(BCLog::ADDRMAN, "Added %i addresses from %s: %i tried, %i new\n", nAdd, source.ToString(), nTried, nNew);
}
return nAdd > 0;
}

Expand Down
8 changes: 4 additions & 4 deletions src/alert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,13 @@ bool CAlert::ProcessAlert(const std::vector<unsigned char>& alertKey, bool fThre
const CAlert& alert = (*mi).second;
if (Cancels(alert))
{
LogPrint("alert", "cancelling alert %d\n", alert.nID);
LogPrint(BCLog::ALERT, "cancelling alert %d\n", alert.nID);
uiInterface.NotifyAlertChanged((*mi).first, CT_DELETED);
mapAlerts.erase(mi++);
}
else if (!alert.IsInEffect())
{
LogPrint("alert", "expiring alert %d\n", alert.nID);
LogPrint(BCLog::ALERT, "expiring alert %d\n", alert.nID);
uiInterface.NotifyAlertChanged((*mi).first, CT_DELETED);
mapAlerts.erase(mi++);
}
Expand All @@ -246,7 +246,7 @@ bool CAlert::ProcessAlert(const std::vector<unsigned char>& alertKey, bool fThre
const CAlert& alert = item.second;
if (alert.Cancels(*this))
{
LogPrint("alert", "alert already cancelled by %d\n", alert.nID);
LogPrint(BCLog::ALERT, "alert already cancelled by %d\n", alert.nID);
return false;
}
}
Expand All @@ -261,7 +261,7 @@ bool CAlert::ProcessAlert(const std::vector<unsigned char>& alertKey, bool fThre
}
}

LogPrint("alert", "accepted alert %d, AppliesToMe()=%d\n", nID, AppliesToMe());
LogPrint(BCLog::ALERT, "accepted alert %d, AppliesToMe()=%d\n", nID, AppliesToMe());
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/batchedlogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include "batchedlogger.h"
#include "util.h"

CBatchedLogger::CBatchedLogger(const std::string& _category, const std::string& _header) :
accept(LogAcceptCategory(_category.c_str())), header(_header)
CBatchedLogger::CBatchedLogger(uint64_t _category, const std::string& _header) :
accept(LogAcceptCategory(_category)), header(_header)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/batchedlogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CBatchedLogger
std::string header;
std::string msg;
public:
CBatchedLogger(const std::string& _category, const std::string& _header);
CBatchedLogger(uint64_t _category, const std::string& _header);
virtual ~CBatchedLogger();

template<typename... Args>
Expand Down
9 changes: 5 additions & 4 deletions src/blockencodings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c
break;
}

LogPrint("cmpctblock", "Initialized PartiallyDownloadedBlock for block %s using a cmpctblock of size %lu\n", cmpctblock.header.GetHash().ToString(), GetSerializeSize(cmpctblock, SER_NETWORK, PROTOCOL_VERSION));
LogPrint(BCLog::CMPCTBLOCK, "Initialized PartiallyDownloadedBlock for block %s using a cmpctblock of size %lu\n", cmpctblock.header.GetHash().ToString(), GetSerializeSize(cmpctblock, SER_NETWORK, PROTOCOL_VERSION));

return READ_STATUS_OK;
}
Expand Down Expand Up @@ -209,10 +209,11 @@ ReadStatus PartiallyDownloadedBlock::FillBlock(CBlock& block, const std::vector<
return READ_STATUS_CHECKBLOCK_FAILED;
}

LogPrint("cmpctblock", "Successfully reconstructed block %s with %lu txn prefilled, %lu txn from mempool (incl at least %lu from extra pool) and %lu txn requested\n", hash.ToString(), prefilled_count, mempool_count, extra_count, vtx_missing.size());
LogPrint(BCLog::CMPCTBLOCK, "Successfully reconstructed block %s with %lu txn prefilled, %lu txn from mempool (incl at least %lu from extra pool) and %lu txn requested\n", hash.ToString(), prefilled_count, mempool_count, extra_count, vtx_missing.size());
if (vtx_missing.size() < 5) {
for (const auto& tx : vtx_missing)
LogPrint("cmpctblock", "Reconstructed block %s required tx %s\n", hash.ToString(), tx->GetHash().ToString());
for (const auto& tx : vtx_missing) {
LogPrint(BCLog::CMPCTBLOCK, "Reconstructed block %s required tx %s\n", hash.ToString(), tx->GetHash().ToString());
}
}

return READ_STATUS_OK;
Expand Down
3 changes: 2 additions & 1 deletion src/dbwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ class CBitcoinLevelDBLogger : public leveldb::Logger {
// This code is adapted from posix_logger.h, which is why it is using vsprintf.
// Please do not do this in normal code
virtual void Logv(const char * format, va_list ap) override {
if (!LogAcceptCategory("leveldb"))
if (!LogAcceptCategory(BCLog::LEVELDB)) {
return;
}
char buffer[500];
for (int iter = 0; iter < 2; iter++) {
char* base;
Expand Down
20 changes: 10 additions & 10 deletions src/evo/cbtx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ bool CheckCbTxMerkleRoots(const CBlock& block, const CBlockIndex* pindex, CValid
}

int64_t nTime2 = GetTimeMicros(); nTimePayload += nTime2 - nTime1;
LogPrint("bench", " - GetTxPayload: %.2fms [%.2fs]\n", 0.001 * (nTime2 - nTime1), nTimePayload * 0.000001);
LogPrint(BCLog::BENCHMARK, " - GetTxPayload: %.2fms [%.2fs]\n", 0.001 * (nTime2 - nTime1), nTimePayload * 0.000001);

if (pindex) {
uint256 calculatedMerkleRoot;
Expand All @@ -79,7 +79,7 @@ bool CheckCbTxMerkleRoots(const CBlock& block, const CBlockIndex* pindex, CValid
}

int64_t nTime3 = GetTimeMicros(); nTimeMerkleMNL += nTime3 - nTime2;
LogPrint("bench", " - CalcCbTxMerkleRootMNList: %.2fms [%.2fs]\n", 0.001 * (nTime3 - nTime2), nTimeMerkleMNL * 0.000001);
LogPrint(BCLog::BENCHMARK, " - CalcCbTxMerkleRootMNList: %.2fms [%.2fs]\n", 0.001 * (nTime3 - nTime2), nTimeMerkleMNL * 0.000001);

if (cbTx.nVersion >= 2) {
if (!CalcCbTxMerkleRootQuorums(block, pindex->pprev, calculatedMerkleRoot, state)) {
Expand All @@ -91,7 +91,7 @@ bool CheckCbTxMerkleRoots(const CBlock& block, const CBlockIndex* pindex, CValid
}

int64_t nTime4 = GetTimeMicros(); nTimeMerkleQuorum += nTime4 - nTime3;
LogPrint("bench", " - CalcCbTxMerkleRootQuorums: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime3), nTimeMerkleQuorum * 0.000001);
LogPrint(BCLog::BENCHMARK, " - CalcCbTxMerkleRootQuorums: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime3), nTimeMerkleQuorum * 0.000001);

}

Expand All @@ -114,12 +114,12 @@ bool CalcCbTxMerkleRootMNList(const CBlock& block, const CBlockIndex* pindexPrev
}

int64_t nTime2 = GetTimeMicros(); nTimeDMN += nTime2 - nTime1;
LogPrint("bench", " - BuildNewListFromBlock: %.2fms [%.2fs]\n", 0.001 * (nTime2 - nTime1), nTimeDMN * 0.000001);
LogPrint(BCLog::BENCHMARK, " - BuildNewListFromBlock: %.2fms [%.2fs]\n", 0.001 * (nTime2 - nTime1), nTimeDMN * 0.000001);

CSimplifiedMNList sml(tmpMNList);

int64_t nTime3 = GetTimeMicros(); nTimeSMNL += nTime3 - nTime2;
LogPrint("bench", " - CSimplifiedMNList: %.2fms [%.2fs]\n", 0.001 * (nTime3 - nTime2), nTimeSMNL * 0.000001);
LogPrint(BCLog::BENCHMARK, " - CSimplifiedMNList: %.2fms [%.2fs]\n", 0.001 * (nTime3 - nTime2), nTimeSMNL * 0.000001);

static CSimplifiedMNList smlCached;
static uint256 merkleRootCached;
Expand All @@ -134,7 +134,7 @@ bool CalcCbTxMerkleRootMNList(const CBlock& block, const CBlockIndex* pindexPrev
merkleRootRet = sml.CalcMerkleRoot(&mutated);

int64_t nTime4 = GetTimeMicros(); nTimeMerkle += nTime4 - nTime3;
LogPrint("bench", " - CalcMerkleRoot: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime3), nTimeMerkle * 0.000001);
LogPrint(BCLog::BENCHMARK, " - CalcMerkleRoot: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime3), nTimeMerkle * 0.000001);

smlCached = std::move(sml);
merkleRootCached = merkleRootRet;
Expand All @@ -160,7 +160,7 @@ bool CalcCbTxMerkleRootQuorums(const CBlock& block, const CBlockIndex* pindexPre
size_t hashCount = 0;

int64_t nTime2 = GetTimeMicros(); nTimeMinedAndActive += nTime2 - nTime1;
LogPrint("bench", " - GetMinedAndActiveCommitmentsUntilBlock: %.2fms [%.2fs]\n", 0.001 * (nTime2 - nTime1), nTimeMinedAndActive * 0.000001);
LogPrint(BCLog::BENCHMARK, " - GetMinedAndActiveCommitmentsUntilBlock: %.2fms [%.2fs]\n", 0.001 * (nTime2 - nTime1), nTimeMinedAndActive * 0.000001);

if (quorums == quorumsCached) {
qcHashes = qcHashesCached;
Expand All @@ -182,7 +182,7 @@ bool CalcCbTxMerkleRootQuorums(const CBlock& block, const CBlockIndex* pindexPre
}

int64_t nTime3 = GetTimeMicros(); nTimeMined += nTime3 - nTime2;
LogPrint("bench", " - GetMinedCommitment: %.2fms [%.2fs]\n", 0.001 * (nTime3 - nTime2), nTimeMined * 0.000001);
LogPrint(BCLog::BENCHMARK, " - GetMinedCommitment: %.2fms [%.2fs]\n", 0.001 * (nTime3 - nTime2), nTimeMined * 0.000001);

// now add the commitments from the current block, which are not returned by GetMinedAndActiveCommitmentsUntilBlock
// due to the use of pindexPrev (we don't have the tip index here)
Expand Down Expand Up @@ -220,13 +220,13 @@ bool CalcCbTxMerkleRootQuorums(const CBlock& block, const CBlockIndex* pindexPre
std::sort(qcHashesVec.begin(), qcHashesVec.end());

int64_t nTime4 = GetTimeMicros(); nTimeLoop += nTime4 - nTime3;
LogPrint("bench", " - Loop: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime3), nTimeLoop * 0.000001);
LogPrint(BCLog::BENCHMARK, " - Loop: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime3), nTimeLoop * 0.000001);

bool mutated = false;
merkleRootRet = ComputeMerkleRoot(qcHashesVec, &mutated);

int64_t nTime5 = GetTimeMicros(); nTimeMerkle += nTime5 - nTime4;
LogPrint("bench", " - ComputeMerkleRoot: %.2fms [%.2fs]\n", 0.001 * (nTime5 - nTime4), nTimeMerkle * 0.000001);
LogPrint(BCLog::BENCHMARK, " - ComputeMerkleRoot: %.2fms [%.2fs]\n", 0.001 * (nTime5 - nTime4), nTimeMerkle * 0.000001);

return !mutated;
}
Expand Down
8 changes: 4 additions & 4 deletions src/evo/mnauth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void CMNAuth::PushMNAUTH(CNode* pnode, CConnman& connman)
mnauth.proRegTxHash = activeMasternodeInfo.proTxHash;
mnauth.sig = activeMasternodeInfo.blsKeyOperator->Sign(signHash);

LogPrint("net", "CMNAuth::%s -- Sending MNAUTH, peer=%d\n", __func__, pnode->id);
LogPrint(BCLog::NET, "CMNAuth::%s -- Sending MNAUTH, peer=%d\n", __func__, pnode->id);

connman.PushMessage(pnode, CNetMsgMaker(pnode->GetSendVersion()).Make(NetMsgType::MNAUTH, mnauth));
}
Expand Down Expand Up @@ -99,7 +99,7 @@ void CMNAuth::ProcessMessage(CNode* pnode, const std::string& strCommand, CDataS

connman.ForEachNode([&](CNode* pnode2) {
if (pnode2->verifiedProRegTxHash == mnauth.proRegTxHash) {
LogPrint("net", "CMNAuth::ProcessMessage -- Masternode %s has already verified as peer %d, dropping old connection. peer=%d\n",
LogPrint(BCLog::NET, "CMNAuth::ProcessMessage -- Masternode %s has already verified as peer %d, dropping old connection. peer=%d\n",
mnauth.proRegTxHash.ToString(), pnode2->id, pnode->id);
pnode2->fDisconnect = true;
}
Expand All @@ -111,7 +111,7 @@ void CMNAuth::ProcessMessage(CNode* pnode, const std::string& strCommand, CDataS
pnode->verifiedPubKeyHash = dmn->pdmnState->pubKeyOperator.GetHash();
}

LogPrint("net", "CMNAuth::%s -- Valid MNAUTH for %s, peer=%d\n", __func__, mnauth.proRegTxHash.ToString(), pnode->id);
LogPrint(BCLog::NET, "CMNAuth::%s -- Valid MNAUTH for %s, peer=%d\n", __func__, mnauth.proRegTxHash.ToString(), pnode->id);
}
}

Expand Down Expand Up @@ -140,7 +140,7 @@ void CMNAuth::NotifyMasternodeListChanged(bool undo, const CDeterministicMNList&
}

if (doRemove) {
LogPrint("net", "CMNAuth::NotifyMasternodeListChanged -- Disconnecting MN %s due to key changed/removed, peer=%d\n",
LogPrint(BCLog::NET, "CMNAuth::NotifyMasternodeListChanged -- Disconnecting MN %s due to key changed/removed, peer=%d\n",
pnode->verifiedProRegTxHash.ToString(), pnode->id);
pnode->fDisconnect = true;
}
Expand Down
8 changes: 4 additions & 4 deletions src/evo/specialtx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,28 +106,28 @@ bool ProcessSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex, CV
}

int64_t nTime2 = GetTimeMicros(); nTimeLoop += nTime2 - nTime1;
LogPrint("bench", " - Loop: %.2fms [%.2fs]\n", 0.001 * (nTime2 - nTime1), nTimeLoop * 0.000001);
LogPrint(BCLog::BENCHMARK, " - Loop: %.2fms [%.2fs]\n", 0.001 * (nTime2 - nTime1), nTimeLoop * 0.000001);

if (!llmq::quorumBlockProcessor->ProcessBlock(block, pindex, state)) {
return false;
}

int64_t nTime3 = GetTimeMicros(); nTimeQuorum += nTime3 - nTime2;
LogPrint("bench", " - quorumBlockProcessor: %.2fms [%.2fs]\n", 0.001 * (nTime3 - nTime2), nTimeQuorum * 0.000001);
LogPrint(BCLog::BENCHMARK, " - quorumBlockProcessor: %.2fms [%.2fs]\n", 0.001 * (nTime3 - nTime2), nTimeQuorum * 0.000001);

if (!deterministicMNManager->ProcessBlock(block, pindex, state, fJustCheck)) {
return false;
}

int64_t nTime4 = GetTimeMicros(); nTimeDMN += nTime4 - nTime3;
LogPrint("bench", " - deterministicMNManager: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime3), nTimeDMN * 0.000001);
LogPrint(BCLog::BENCHMARK, " - deterministicMNManager: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime3), nTimeDMN * 0.000001);

if (fCheckCbTxMerleRoots && !CheckCbTxMerkleRoots(block, pindex, state)) {
return false;
}

int64_t nTime5 = GetTimeMicros(); nTimeMerkle += nTime5 - nTime4;
LogPrint("bench", " - CheckCbTxMerkleRoots: %.2fms [%.2fs]\n", 0.001 * (nTime5 - nTime4), nTimeMerkle * 0.000001);
LogPrint(BCLog::BENCHMARK, " - CheckCbTxMerkleRoots: %.2fms [%.2fs]\n", 0.001 * (nTime5 - nTime4), nTimeMerkle * 0.000001);

return true;
}
Expand Down
Loading