diff --git a/src/cpp/database/SqliteDatabase.cpp b/src/cpp/database/SqliteDatabase.cpp index dd644f24b..6edb44ad1 100644 --- a/src/cpp/database/SqliteDatabase.cpp +++ b/src/cpp/database/SqliteDatabase.cpp @@ -12,6 +12,8 @@ #include "../ripple/JobQueue.h" #include "../ripple/Log.h" +SETUP_LOG (SqliteDatabase) + using namespace std; SqliteDatabase::SqliteDatabase(const char* host) : Database(host,"",""), mWalQ(NULL), walRunning(false) diff --git a/src/cpp/ripple/AccountSetTransactor.cpp b/src/cpp/ripple/AccountSetTransactor.cpp index f1cc4b44a..fbb2b46e9 100644 --- a/src/cpp/ripple/AccountSetTransactor.cpp +++ b/src/cpp/ripple/AccountSetTransactor.cpp @@ -1,3 +1,4 @@ +SETUP_LOG (AccountSetTransactor) TER AccountSetTransactor::doApply() { diff --git a/src/cpp/ripple/Amount.cpp b/src/cpp/ripple/Amount.cpp index ec4e45430..f9b94a905 100644 --- a/src/cpp/ripple/Amount.cpp +++ b/src/cpp/ripple/Amount.cpp @@ -14,6 +14,8 @@ #include "SerializedTypes.h" #include "utils.h" +SETUP_LOG (STAmount) + uint64 STAmount::uRateOne = STAmount::getRate(STAmount(1), STAmount(1)); diff --git a/src/cpp/ripple/Application.cpp b/src/cpp/ripple/Application.cpp index 961555cd8..c898d4c57 100644 --- a/src/cpp/ripple/Application.cpp +++ b/src/cpp/ripple/Application.cpp @@ -24,6 +24,9 @@ #include #include +SETUP_LOG (Application) + +// VFALCO: TODO, fix this, it might have broken with the Log changes LogPartition TaggedCachePartition("TaggedCache"); LogPartition AutoSocketPartition("AutoSocket"); Application* theApp = NULL; diff --git a/src/cpp/ripple/CallRPC.cpp b/src/cpp/ripple/CallRPC.cpp index 3f5faec10..b17c2d4f4 100644 --- a/src/cpp/ripple/CallRPC.cpp +++ b/src/cpp/ripple/CallRPC.cpp @@ -32,6 +32,8 @@ #include "CallRPC.h" +SETUP_LOG (RPCParser) + static inline bool isSwitchChar(char c) { #ifdef __WXMSW__ diff --git a/src/cpp/ripple/ChangeTransactor.cpp b/src/cpp/ripple/ChangeTransactor.cpp index bf9330ba2..fa9723732 100644 --- a/src/cpp/ripple/ChangeTransactor.cpp +++ b/src/cpp/ripple/ChangeTransactor.cpp @@ -1,4 +1,6 @@ +SETUP_LOG (ChangeTransactor) + TER ChangeTransactor::doApply() { if (mTxn.getTxnType() == ttFEATURE) diff --git a/src/cpp/ripple/ConnectionPool.cpp b/src/cpp/ripple/ConnectionPool.cpp index fca6565e1..e49ba5357 100644 --- a/src/cpp/ripple/ConnectionPool.cpp +++ b/src/cpp/ripple/ConnectionPool.cpp @@ -18,6 +18,8 @@ // How often to enforce policies. #define POLICY_INTERVAL_SECONDS 5 +SETUP_LOG (ConnectionPool) + void splitIpPort(const std::string& strIpPort, std::string& strIp, int& iPort) { std::vector vIpPort; diff --git a/src/cpp/ripple/FeatureTable.cpp b/src/cpp/ripple/FeatureTable.cpp index 886c4bdbb..e76e7cb15 100644 --- a/src/cpp/ripple/FeatureTable.cpp +++ b/src/cpp/ripple/FeatureTable.cpp @@ -1,4 +1,6 @@ +SETUP_LOG (FeatureTable) + void FeatureTable::addInitialFeatures() { // For each feature this version supports, call enableFeature. diff --git a/src/cpp/ripple/HTTPRequest.cpp b/src/cpp/ripple/HTTPRequest.cpp index 7b7e202ba..4ef78b726 100644 --- a/src/cpp/ripple/HTTPRequest.cpp +++ b/src/cpp/ripple/HTTPRequest.cpp @@ -6,6 +6,8 @@ #include "Log.h" +SETUP_LOG (HTTPRequest) + // Logic to handle incoming HTTP reqests void HTTPRequest::reset() diff --git a/src/cpp/ripple/HashedObject.cpp b/src/cpp/ripple/HashedObject.cpp index 8c71b5786..88111eda8 100644 --- a/src/cpp/ripple/HashedObject.cpp +++ b/src/cpp/ripple/HashedObject.cpp @@ -14,6 +14,8 @@ #include "Application.h" #include "Log.h" +SETUP_LOG (HashedObject) + DECLARE_INSTANCE(HashedObject); HashedObjectStore::HashedObjectStore(int cacheSize, int cacheAge) : diff --git a/src/cpp/ripple/HttpsClient.cpp b/src/cpp/ripple/HttpsClient.cpp index e5530417a..857cdcdc2 100644 --- a/src/cpp/ripple/HttpsClient.cpp +++ b/src/cpp/ripple/HttpsClient.cpp @@ -16,6 +16,8 @@ #define CLIENT_MAX_HEADER (32*1024) +SETUP_LOG (HttpsClient) + using namespace boost::system; using namespace boost::asio; diff --git a/src/cpp/ripple/JobQueue.cpp b/src/cpp/ripple/JobQueue.cpp index 3f07c3c58..cc116f65c 100644 --- a/src/cpp/ripple/JobQueue.cpp +++ b/src/cpp/ripple/JobQueue.cpp @@ -8,6 +8,8 @@ #include "Config.h" #include "Application.h" +SETUP_LOG (JobQueue) + JobQueue::JobQueue(boost::asio::io_service& svc) : mLastJob(0), mThreadCount(0), mShuttingDown(false), mIOThreadCount(0), mMaxIOThreadCount(1), mIOService(svc) { diff --git a/src/cpp/ripple/Ledger.cpp b/src/cpp/ripple/Ledger.cpp index 712f529d0..14c943001 100644 --- a/src/cpp/ripple/Ledger.cpp +++ b/src/cpp/ripple/Ledger.cpp @@ -1,4 +1,6 @@ +SETUP_LOG (Ledger) + DECLARE_INSTANCE(Ledger); Ledger::Ledger(const RippleAddress& masterID, uint64 startAmount) : mTotCoins(startAmount), mLedgerSeq(1), diff --git a/src/cpp/ripple/LedgerAcquire.cpp b/src/cpp/ripple/LedgerAcquire.cpp index ac7068e7c..e2aa2e599 100644 --- a/src/cpp/ripple/LedgerAcquire.cpp +++ b/src/cpp/ripple/LedgerAcquire.cpp @@ -1,4 +1,6 @@ +SETUP_LOG (LedgerAcquire) + DECLARE_INSTANCE(LedgerAcquire); #define LA_DEBUG diff --git a/src/cpp/ripple/LedgerConsensus.cpp b/src/cpp/ripple/LedgerConsensus.cpp index 9a1daf7f4..65db04a62 100644 --- a/src/cpp/ripple/LedgerConsensus.cpp +++ b/src/cpp/ripple/LedgerConsensus.cpp @@ -9,10 +9,12 @@ typedef std::map::value_type u160_prop_pair; typedef std::map::value_type u256_lct_pair; -class LedgerConensus; +SETUP_LOG (LedgerConsensus) DECLARE_INSTANCE(LedgerConsensus); +// VFALCO: TODO, move LCTransaction to its own file and rename to ConsensusTransactor +// void LCTransaction::setVote(const uint160& peer, bool votesYes) { // Track a peer's yes/no vote on a particular disputed transaction std::pair::iterator, bool> res = @@ -22,25 +24,25 @@ void LCTransaction::setVote(const uint160& peer, bool votesYes) { // new vote if (votesYes) { - WriteLog (lsDEBUG, LedgerConensus) << "Peer " << peer << " votes YES on " << mTransactionID; + WriteLog (lsDEBUG, LedgerConsensus) << "Peer " << peer << " votes YES on " << mTransactionID; ++mYays; } else { - WriteLog (lsDEBUG, LedgerConensus) << "Peer " << peer << " votes NO on " << mTransactionID; + WriteLog (lsDEBUG, LedgerConsensus) << "Peer " << peer << " votes NO on " << mTransactionID; ++mNays; } } else if (votesYes && !res.first->second) { // changes vote to yes - WriteLog (lsDEBUG, LedgerConensus) << "Peer " << peer << " now votes YES on " << mTransactionID; + WriteLog (lsDEBUG, LedgerConsensus) << "Peer " << peer << " now votes YES on " << mTransactionID; --mNays; ++mYays; res.first->second = true; } else if (!votesYes && res.first->second) { // changes vote to no - WriteLog (lsDEBUG, LedgerConensus) << "Peer " << peer << " now votes NO on " << mTransactionID; + WriteLog (lsDEBUG, LedgerConsensus) << "Peer " << peer << " now votes NO on " << mTransactionID; ++mNays; --mYays; res.first->second = false; @@ -92,15 +94,15 @@ bool LCTransaction::updateVote(int percentTime, bool proposing) if (newPosition == mOurVote) { - WriteLog (lsINFO, LedgerConensus) << + WriteLog (lsINFO, LedgerConsensus) << "No change (" << (mOurVote ? "YES" : "NO") << ") : weight " << weight << ", percent " << percentTime; - WriteLog (lsDEBUG, LedgerConensus) << getJson(); + WriteLog (lsDEBUG, LedgerConsensus) << getJson(); return false; } mOurVote = newPosition; - WriteLog (lsDEBUG, LedgerConensus) << "We now vote " << (mOurVote ? "YES" : "NO") << " on " << mTransactionID; - WriteLog (lsDEBUG, LedgerConensus) << getJson(); + WriteLog (lsDEBUG, LedgerConsensus) << "We now vote " << (mOurVote ? "YES" : "NO") << " on " << mTransactionID; + WriteLog (lsDEBUG, LedgerConsensus) << getJson(); return true; } @@ -130,8 +132,8 @@ LedgerConsensus::LedgerConsensus(const uint256& prevLCLHash, Ledger::ref previou mCurrentMSeconds(0), mClosePercent(0), mHaveCloseTimeConsensus(false), mConsensusStartTime(boost::posix_time::microsec_clock::universal_time()) { - WriteLog (lsDEBUG, LedgerConensus) << "Creating consensus object"; - WriteLog (lsTRACE, LedgerConensus) << "LCL:" << previousLedger->getHash() <<", ct=" << closeTime; + WriteLog (lsDEBUG, LedgerConsensus) << "Creating consensus object"; + WriteLog (lsTRACE, LedgerConsensus) << "LCL:" << previousLedger->getHash() <<", ct=" << closeTime; mPreviousProposers = theApp->getOPs().getPreviousProposers(); mPreviousMSeconds = theApp->getOPs().getPreviousConvergeTime(); assert(mPreviousMSeconds); @@ -141,13 +143,13 @@ LedgerConsensus::LedgerConsensus(const uint256& prevLCLHash, Ledger::ref previou if (mValPublic.isSet() && mValPrivate.isSet() && !theApp->getOPs().isNeedNetworkLedger()) { - WriteLog (lsINFO, LedgerConensus) << "Entering consensus process, validating"; + WriteLog (lsINFO, LedgerConsensus) << "Entering consensus process, validating"; mValidating = true; mProposing = theApp->getOPs().getOperatingMode() == NetworkOPs::omFULL; } else { - WriteLog (lsINFO, LedgerConensus) << "Entering consensus process, watching"; + WriteLog (lsINFO, LedgerConsensus) << "Entering consensus process, watching"; mProposing = mValidating = false; } @@ -159,8 +161,8 @@ LedgerConsensus::LedgerConsensus(const uint256& prevLCLHash, Ledger::ref previou if (!mHaveCorrectLCL) { // mProposing = mValidating = false; - WriteLog (lsINFO, LedgerConensus) << "Entering consensus with: " << previousLedger->getHash(); - WriteLog (lsINFO, LedgerConensus) << "Correct LCL is: " << prevLCLHash; + WriteLog (lsINFO, LedgerConsensus) << "Entering consensus with: " << previousLedger->getHash(); + WriteLog (lsINFO, LedgerConsensus) << "Correct LCL is: " << prevLCLHash; } } else @@ -196,7 +198,7 @@ void LedgerConsensus::checkOurValidation() boost::make_shared(val, ripple::mtVALIDATION)); #endif theApp->getOPs().setLastValidation(v); - WriteLog (lsWARNING, LedgerConensus) << "Sending partial validation"; + WriteLog (lsWARNING, LedgerConsensus) << "Sending partial validation"; } void LedgerConsensus::checkLCL() @@ -232,15 +234,15 @@ void LedgerConsensus::checkLCL() default: status = "unknown"; } - WriteLog (lsWARNING, LedgerConensus) << "View of consensus changed during " << status << " (" << netLgrCount << ") status=" + WriteLog (lsWARNING, LedgerConsensus) << "View of consensus changed during " << status << " (" << netLgrCount << ") status=" << status << ", " << (mHaveCorrectLCL ? "CorrectLCL" : "IncorrectLCL"); - WriteLog (lsWARNING, LedgerConensus) << mPrevLedgerHash << " to " << netLgr; - WriteLog (lsWARNING, LedgerConensus) << mPreviousLedger->getJson(0); + WriteLog (lsWARNING, LedgerConsensus) << mPrevLedgerHash << " to " << netLgr; + WriteLog (lsWARNING, LedgerConsensus) << mPreviousLedger->getJson(0); - if (ShouldLog (lsDEBUG, LedgerConensus)) + if (ShouldLog (lsDEBUG, LedgerConsensus)) { BOOST_FOREACH(u256_cvc_pair& it, vals) - WriteLog (lsDEBUG, LedgerConensus) << "V: " << it.first << ", " << it.second.first; + WriteLog (lsDEBUG, LedgerConsensus) << "V: " << it.first << ", " << it.second.first; } if (mHaveCorrectLCL) @@ -260,7 +262,7 @@ void LedgerConsensus::handleLCL(const uint256& lclHash) if (mHaveCorrectLCL && mProposing && mOurPosition) { - WriteLog (lsINFO, LedgerConensus) << "Bowing out of consensus"; + WriteLog (lsINFO, LedgerConsensus) << "Bowing out of consensus"; mOurPosition->bowOut(); propose(); } @@ -288,7 +290,7 @@ void LedgerConsensus::handleLCL(const uint256& lclHash) } else if (!mAcquiringLedger || (mAcquiringLedger->getHash() != mPrevLedgerHash)) { // need to start acquiring the correct consensus LCL - WriteLog (lsWARNING, LedgerConensus) << "Need consensus ledger " << mPrevLedgerHash; + WriteLog (lsWARNING, LedgerConsensus) << "Need consensus ledger " << mPrevLedgerHash; if (mAcquiringLedger) theApp->getMasterLedgerAcquire().dropLedger(mAcquiringLedger->getHash()); mAcquiringLedger = theApp->getMasterLedgerAcquire().findCreate(mPrevLedgerHash, 0); @@ -296,7 +298,7 @@ void LedgerConsensus::handleLCL(const uint256& lclHash) return; } - WriteLog (lsINFO, LedgerConensus) << "Have the consensus ledger " << mPrevLedgerHash; + WriteLog (lsINFO, LedgerConsensus) << "Have the consensus ledger " << mPrevLedgerHash; mHaveCorrectLCL = true; mCloseResolution = ContinuousLedgerTiming::getNextLedgerTimeResolution( @@ -319,7 +321,7 @@ void LedgerConsensus::takeInitialPosition(Ledger& initialLedger) else initialSet = initialLedger.peekTransactionMap()->snapShot(false); uint256 txSet = initialSet->getHash(); - WriteLog (lsINFO, LedgerConensus) << "initial position " << txSet; + WriteLog (lsINFO, LedgerConsensus) << "initial position " << txSet; mapComplete(txSet, initialSet, false); if (mValidating) @@ -387,13 +389,13 @@ void LedgerConsensus::createDisputes(SHAMap::ref m1, SHAMap::ref m2) void LedgerConsensus::mapComplete(const uint256& hash, SHAMap::ref map, bool acquired) { - CondLog (acquired, lsINFO, LedgerConensus) << "We have acquired TXS " << hash; + CondLog (acquired, lsINFO, LedgerConsensus) << "We have acquired TXS " << hash; if (!map) { // this is an invalid/corrupt map mAcquired[hash] = map; mAcquiring.erase(hash); - WriteLog (lsWARNING, LedgerConensus) << "A trusted node directed us to acquire an invalid TXN map"; + WriteLog (lsWARNING, LedgerConsensus) << "A trusted node directed us to acquire an invalid TXN map"; return; } assert(hash == map->getHash()); @@ -436,7 +438,7 @@ void LedgerConsensus::mapComplete(const uint256& hash, SHAMap::ref map, bool acq adjustCount(map, peers); else { - CondLog (acquired, lsWARNING, LedgerConensus) << "By the time we got the map " << hash << " no peers were proposing it"; + CondLog (acquired, lsWARNING, LedgerConsensus) << "By the time we got the map " << hash << " no peers were proposing it"; } sendHaveTxSet(hash, true); @@ -482,7 +484,7 @@ void LedgerConsensus::statusChange(ripple::NodeEvent event, Ledger& ledger) PackedMessage::pointer packet = boost::make_shared(s, ripple::mtSTATUS_CHANGE); theApp->getConnectionPool().relayMessage(NULL, packet); - WriteLog (lsTRACE, LedgerConensus) << "send status change to peer"; + WriteLog (lsTRACE, LedgerConsensus) << "send status change to peer"; } int LedgerConsensus::startup() @@ -538,11 +540,11 @@ void LedgerConsensus::stateEstablish() updateOurPositions(); if (!mHaveCloseTimeConsensus) { - CondLog (haveConsensus(false), lsINFO, LedgerConensus) << "We have TX consensus but not CT consensus"; + CondLog (haveConsensus(false), lsINFO, LedgerConsensus) << "We have TX consensus but not CT consensus"; } else if (haveConsensus(true)) { - WriteLog (lsINFO, LedgerConensus) << "Converge cutoff (" << mPeerPositions.size() << " participants)"; + WriteLog (lsINFO, LedgerConsensus) << "Converge cutoff (" << mPeerPositions.size() << " participants)"; mState = lcsFINISHED; beginAccept(false); } @@ -565,7 +567,7 @@ void LedgerConsensus::timerEntry() { if (doShutdown) { - WriteLog (lsFATAL, LedgerConensus) << "Shutdown requested"; + WriteLog (lsFATAL, LedgerConsensus) << "Shutdown requested"; theApp->stop(); } @@ -604,7 +606,7 @@ void LedgerConsensus::updateOurPositions() if (it->second->isStale(peerCutoff)) { // proposal is stale uint160 peerID = it->second->getPeerID(); - WriteLog (lsWARNING, LedgerConensus) << "Removing stale proposal from " << peerID; + WriteLog (lsWARNING, LedgerConsensus) << "Removing stale proposal from " << peerID; BOOST_FOREACH(u256_lct_pair& it, mDisputes) it.second->unVote(peerID); it = mPeerPositions.erase(it); @@ -676,23 +678,23 @@ void LedgerConsensus::updateOurPositions() threshVote = 1; if (threshConsensus == 0) threshConsensus = 1; - WriteLog (lsINFO, LedgerConensus) << "Proposers:" << mPeerPositions.size() << " nw:" << neededWeight + WriteLog (lsINFO, LedgerConsensus) << "Proposers:" << mPeerPositions.size() << " nw:" << neededWeight << " thrV:" << threshVote << " thrC:" << threshConsensus; for (std::map::iterator it = closeTimes.begin(), end = closeTimes.end(); it != end; ++it) { - WriteLog (lsDEBUG, LedgerConensus) << "CCTime: seq" << mPreviousLedger->getLedgerSeq() + 1 << ": " << + WriteLog (lsDEBUG, LedgerConsensus) << "CCTime: seq" << mPreviousLedger->getLedgerSeq() + 1 << ": " << it->first << " has " << it->second << ", " << threshVote << " required"; if (it->second >= threshVote) { - WriteLog (lsDEBUG, LedgerConensus) << "Close time consensus reached: " << it->first; + WriteLog (lsDEBUG, LedgerConsensus) << "Close time consensus reached: " << it->first; closeTime = it->first; threshVote = it->second; if (threshVote >= threshConsensus) mHaveCloseTimeConsensus = true; } } - CondLog (!mHaveCloseTimeConsensus, lsDEBUG, LedgerConensus) << "No CT consensus: Proposers:" << mPeerPositions.size() + CondLog (!mHaveCloseTimeConsensus, lsDEBUG, LedgerConsensus) << "No CT consensus: Proposers:" << mPeerPositions.size() << " Proposing:" << (mProposing ? "yes" : "no") << " Thresh:" << threshConsensus << " Pos:" << closeTime; } @@ -708,7 +710,7 @@ void LedgerConsensus::updateOurPositions() if (changes) { uint256 newHash = ourPosition->getHash(); - WriteLog (lsINFO, LedgerConensus) << "Position change: CTime " << closeTime << ", tx " << newHash; + WriteLog (lsINFO, LedgerConsensus) << "Position change: CTime " << closeTime << ", tx " << newHash; if (mOurPosition->changePosition(newHash, closeTime)) { if (mProposing) @@ -730,14 +732,14 @@ bool LedgerConsensus::haveConsensus(bool forReal) ++agree; else { - WriteLog (lsDEBUG, LedgerConensus) << it.first.GetHex() << " has " << it.second->getCurrentHash().GetHex(); + WriteLog (lsDEBUG, LedgerConsensus) << it.first.GetHex() << " has " << it.second->getCurrentHash().GetHex(); ++disagree; } } } int currentValidations = theApp->getValidations().getNodesAfter(mPrevLedgerHash); - WriteLog (lsDEBUG, LedgerConensus) << "Checking for TX consensus: agree=" << agree << ", disagree=" << disagree; + WriteLog (lsDEBUG, LedgerConsensus) << "Checking for TX consensus: agree=" << agree << ", disagree=" << disagree; return ContinuousLedgerTiming::haveConsensus(mPreviousProposers, agree + disagree, agree, currentValidations, mPreviousMSeconds, mCurrentMSeconds, forReal, mConsensusFail); @@ -812,7 +814,7 @@ void LedgerConsensus::startAcquiring(TransactionAcquire::pointer acquire) void LedgerConsensus::propose() { - WriteLog (lsTRACE, LedgerConensus) << "We propose: " << + WriteLog (lsTRACE, LedgerConsensus) << "We propose: " << (mOurPosition->isBowOut() ? std::string("bowOut") : mOurPosition->getCurrentHash().GetHex()); ripple::TMProposeSet prop; @@ -833,7 +835,7 @@ void LedgerConsensus::addDisputedTransaction(const uint256& txID, const std::vec { if (mDisputes.find(txID) != mDisputes.end()) return; - WriteLog (lsDEBUG, LedgerConensus) << "Transaction " << txID << " is disputed"; + WriteLog (lsDEBUG, LedgerConsensus) << "Transaction " << txID << " is disputed"; bool ourVote = false; if (mOurPosition) @@ -872,7 +874,7 @@ bool LedgerConsensus::peerPosition(LedgerProposal::ref newPosition) uint160 peerID = newPosition->getPeerID(); if (mDeadNodes.find(peerID) != mDeadNodes.end()) { - WriteLog (lsINFO, LedgerConensus) << "Position from dead node: " << peerID.GetHex(); + WriteLog (lsINFO, LedgerConsensus) << "Position from dead node: " << peerID.GetHex(); return false; } @@ -887,12 +889,12 @@ bool LedgerConsensus::peerPosition(LedgerProposal::ref newPosition) if (newPosition->getProposeSeq() == 0) { // new initial close time estimate - WriteLog (lsTRACE, LedgerConensus) << "Peer reports close time as " << newPosition->getCloseTime(); + WriteLog (lsTRACE, LedgerConsensus) << "Peer reports close time as " << newPosition->getCloseTime(); ++mCloseTimes[newPosition->getCloseTime()]; } else if (newPosition->getProposeSeq() == LedgerProposal::seqLeave) { // peer bows out - WriteLog (lsINFO, LedgerConensus) << "Peer bows out: " << peerID.GetHex(); + WriteLog (lsINFO, LedgerConsensus) << "Peer bows out: " << peerID.GetHex(); BOOST_FOREACH(u256_lct_pair& it, mDisputes) it.second->unVote(peerID); mPeerPositions.erase(peerID); @@ -901,7 +903,7 @@ bool LedgerConsensus::peerPosition(LedgerProposal::ref newPosition) } - WriteLog (lsTRACE, LedgerConensus) << "Processing peer proposal " + WriteLog (lsTRACE, LedgerConsensus) << "Processing peer proposal " << newPosition->getProposeSeq() << "/" << newPosition->getCurrentHash(); currentPosition = newPosition; @@ -913,7 +915,7 @@ bool LedgerConsensus::peerPosition(LedgerProposal::ref newPosition) } else { - WriteLog (lsDEBUG, LedgerConensus) << "Don't have tx set for peer"; + WriteLog (lsDEBUG, LedgerConsensus) << "Don't have tx set for peer"; // BOOST_FOREACH(u256_lct_pair& it, mDisputes) // it.second->unVote(peerID); } @@ -947,7 +949,7 @@ SMAddNode LedgerConsensus::peerGaveNodes(Peer::ref peer, const uint256& setHash, boost::unordered_map::iterator acq = mAcquiring.find(setHash); if (acq == mAcquiring.end()) { - WriteLog (lsDEBUG, LedgerConensus) << "Got TX data for set no longer acquiring: " << setHash; + WriteLog (lsDEBUG, LedgerConsensus) << "Got TX data for set no longer acquiring: " << setHash; return SMAddNode(); } TransactionAcquire::pointer set = acq->second; // We must keep the set around during the function @@ -959,7 +961,7 @@ void LedgerConsensus::beginAccept(bool synchronous) SHAMap::pointer consensusSet = mAcquired[mOurPosition->getCurrentHash()]; if (!consensusSet) { - WriteLog (lsFATAL, LedgerConensus) << "We don't have a consensus set"; + WriteLog (lsFATAL, LedgerConsensus) << "We don't have a consensus set"; abort(); return; } @@ -989,7 +991,7 @@ void LedgerConsensus::playbackProposals() proposal->setPrevLedger(mPrevLedgerHash); if (proposal->checkSign()) { - WriteLog (lsINFO, LedgerConensus) << "Applying stored proposal"; + WriteLog (lsINFO, LedgerConsensus) << "Applying stored proposal"; relay = peerPosition(proposal); } } @@ -998,13 +1000,13 @@ void LedgerConsensus::playbackProposals() if (relay) { - WriteLog (lsWARNING, LedgerConensus) << "We should do delayed relay of this proposal, but we cannot"; + WriteLog (lsWARNING, LedgerConsensus) << "We should do delayed relay of this proposal, but we cannot"; } #if 0 // FIXME: We can't do delayed relay because we don't have the signature std::set peers if (relay && theApp->getSuppression().swapSet(proposal.getSuppress(), set, SF_RELAYED)) { - WriteLog (lsDEBUG, LedgerConensus) << "Stored proposal delayed relay"; + WriteLog (lsDEBUG, LedgerConsensus) << "Stored proposal delayed relay"; ripple::TMProposeSet set; set.set_proposeseq set.set_currenttxhash(, 256 / 8); @@ -1033,10 +1035,10 @@ int LedgerConsensus::applyTransaction(TransactionEngine& engine, SerializedTrans if (theApp->isNewFlag(txn->getTransactionID(), SF_SIGGOOD)) parms = static_cast(parms | tapNO_CHECK_SIGN); - WriteLog (lsDEBUG, LedgerConensus) << "TXN " << txn->getTransactionID() + WriteLog (lsDEBUG, LedgerConsensus) << "TXN " << txn->getTransactionID() << (openLedger ? " open" : " closed") << (retryAssured ? "/retry" : "/final"); - WriteLog (lsTRACE, LedgerConensus) << txn->getJson(0); + WriteLog (lsTRACE, LedgerConsensus) << txn->getJson(0); #ifndef TRUST_NETWORK try @@ -1047,17 +1049,17 @@ int LedgerConsensus::applyTransaction(TransactionEngine& engine, SerializedTrans TER result = engine.applyTransaction(*txn, parms, didApply); if (didApply) { - WriteLog (lsDEBUG, LedgerConensus) << "Transaction success: " << transHuman(result); + WriteLog (lsDEBUG, LedgerConsensus) << "Transaction success: " << transHuman(result); return LCAT_SUCCESS; } if (isTefFailure(result) || isTemMalformed(result) || isTelLocal(result)) { // failure - WriteLog (lsDEBUG, LedgerConensus) << "Transaction failure: " << transHuman(result); + WriteLog (lsDEBUG, LedgerConsensus) << "Transaction failure: " << transHuman(result); return LCAT_FAIL; } - WriteLog (lsDEBUG, LedgerConensus) << "Transaction retry: " << transHuman(result); + WriteLog (lsDEBUG, LedgerConsensus) << "Transaction retry: " << transHuman(result); assert(!ledger->hasTransaction(txn->getTransactionID())); return LCAT_RETRY; @@ -1065,7 +1067,7 @@ int LedgerConsensus::applyTransaction(TransactionEngine& engine, SerializedTrans } catch (...) { - WriteLog (lsWARNING, LedgerConensus) << "Throws"; + WriteLog (lsWARNING, LedgerConsensus) << "Throws"; return false; } #endif @@ -1079,7 +1081,7 @@ void LedgerConsensus::applyTransactions(SHAMap::ref set, Ledger::ref applyLedger for (SHAMapItem::pointer item = set->peekFirstItem(); !!item; item = set->peekNextItem(item->getTag())) if (!checkLedger->hasTransaction(item->getTag())) { - WriteLog (lsINFO, LedgerConensus) << "Processing candidate transaction: " << item->getTag(); + WriteLog (lsINFO, LedgerConsensus) << "Processing candidate transaction: " << item->getTag(); #ifndef TRUST_NETWORK try { @@ -1092,7 +1094,7 @@ void LedgerConsensus::applyTransactions(SHAMap::ref set, Ledger::ref applyLedger } catch (...) { - WriteLog (lsWARNING, LedgerConensus) << " Throws"; + WriteLog (lsWARNING, LedgerConsensus) << " Throws"; } #endif } @@ -1102,7 +1104,7 @@ void LedgerConsensus::applyTransactions(SHAMap::ref set, Ledger::ref applyLedger for (int pass = 0; pass < LEDGER_TOTAL_PASSES; ++pass) { - WriteLog (lsDEBUG, LedgerConensus) << "Pass: " << pass << " Txns: " << failedTransactions.size() + WriteLog (lsDEBUG, LedgerConsensus) << "Pass: " << pass << " Txns: " << failedTransactions.size() << (certainRetry ? " retriable" : " final"); changes = 0; @@ -1128,11 +1130,11 @@ void LedgerConsensus::applyTransactions(SHAMap::ref set, Ledger::ref applyLedger } catch (...) { - WriteLog (lsWARNING, LedgerConensus) << "Transaction throws"; + WriteLog (lsWARNING, LedgerConsensus) << "Transaction throws"; it = failedTransactions.erase(it); } } - WriteLog (lsDEBUG, LedgerConensus) << "Pass: " << pass << " finished " << changes << " changes"; + WriteLog (lsDEBUG, LedgerConsensus) << "Pass: " << pass << " finished " << changes << " changes"; // A non-retry pass made no changes if (!changes && !certainRetry) @@ -1165,10 +1167,10 @@ void LedgerConsensus::accept(SHAMap::ref set, LoadEvent::pointer) closeTime = mPreviousLedger->getCloseTimeNC() + 1; } - WriteLog (lsDEBUG, LedgerConensus) << "Report: Prop=" << (mProposing ? "yes" : "no") << " val=" << (mValidating ? "yes" : "no") << + WriteLog (lsDEBUG, LedgerConsensus) << "Report: Prop=" << (mProposing ? "yes" : "no") << " val=" << (mValidating ? "yes" : "no") << " corLCL=" << (mHaveCorrectLCL ? "yes" : "no") << " fail="<< (mConsensusFail ? "yes" : "no"); - WriteLog (lsDEBUG, LedgerConensus) << "Report: Prev = " << mPrevLedgerHash << ":" << mPreviousLedger->getLedgerSeq(); - WriteLog (lsDEBUG, LedgerConensus) << "Report: TxSt = " << set->getHash() << ", close " << closeTime << (closeTimeCorrect ? "" : "X"); + WriteLog (lsDEBUG, LedgerConsensus) << "Report: Prev = " << mPrevLedgerHash << ":" << mPreviousLedger->getLedgerSeq(); + WriteLog (lsDEBUG, LedgerConsensus) << "Report: TxSt = " << set->getHash() << ", close " << closeTime << (closeTimeCorrect ? "" : "X"); CanonicalTXSet failedTransactions(set->getHash()); @@ -1176,7 +1178,7 @@ void LedgerConsensus::accept(SHAMap::ref set, LoadEvent::pointer) newLCL->peekTransactionMap()->armDirty(); newLCL->peekAccountStateMap()->armDirty(); - WriteLog (lsDEBUG, LedgerConensus) << "Applying consensus set transactions to the last closed ledger"; + WriteLog (lsDEBUG, LedgerConsensus) << "Applying consensus set transactions to the last closed ledger"; applyTransactions(set, newLCL, newLCL, failedTransactions, false); newLCL->updateSkipList(); newLCL->setClosed(); @@ -1186,23 +1188,23 @@ void LedgerConsensus::accept(SHAMap::ref set, LoadEvent::pointer) // write out dirty nodes (temporarily done here) Most come before setAccepted int fc; while ((fc = SHAMap::flushDirty(*acctNodes, 256, hotACCOUNT_NODE, newLCL->getLedgerSeq())) > 0) - { WriteLog (lsTRACE, LedgerConensus) << "Flushed " << fc << " dirty state nodes"; } + { WriteLog (lsTRACE, LedgerConsensus) << "Flushed " << fc << " dirty state nodes"; } while ((fc = SHAMap::flushDirty(*txnNodes, 256, hotTRANSACTION_NODE, newLCL->getLedgerSeq())) > 0) - { WriteLog (lsTRACE, LedgerConensus) << "Flushed " << fc << " dirty transaction nodes"; } + { WriteLog (lsTRACE, LedgerConsensus) << "Flushed " << fc << " dirty transaction nodes"; } newLCL->setAccepted(closeTime, mCloseResolution, closeTimeCorrect); newLCL->updateHash(); newLCL->setImmutable(); - WriteLog (lsDEBUG, LedgerConensus) << "Report: NewL = " << newLCL->getHash() << ":" << newLCL->getLedgerSeq(); + WriteLog (lsDEBUG, LedgerConsensus) << "Report: NewL = " << newLCL->getHash() << ":" << newLCL->getLedgerSeq(); uint256 newLCLHash = newLCL->getHash(); - if (ShouldLog (lsTRACE, LedgerConensus)) + if (ShouldLog (lsTRACE, LedgerConsensus)) { - WriteLog (lsTRACE, LedgerConensus) << "newLCL"; + WriteLog (lsTRACE, LedgerConsensus) << "newLCL"; Json::Value p; newLCL->addJson(p, LEDGER_JSON_DUMP_TXRP | LEDGER_JSON_DUMP_STATE); - WriteLog (lsTRACE, LedgerConensus) << p; + WriteLog (lsTRACE, LedgerConsensus) << p; } statusChange(ripple::neACCEPTED_LEDGER, *newLCL); @@ -1227,10 +1229,10 @@ void LedgerConsensus::accept(SHAMap::ref set, LoadEvent::pointer) val.set_validation(&validation[0], validation.size()); int j = theApp->getConnectionPool().relayMessage(NULL, boost::make_shared(val, ripple::mtVALIDATION)); - WriteLog (lsINFO, LedgerConensus) << "CNF Val " << newLCLHash << " to " << j << " peers"; + WriteLog (lsINFO, LedgerConsensus) << "CNF Val " << newLCLHash << " to " << j << " peers"; } else - WriteLog (lsINFO, LedgerConensus) << "CNF newLCL " << newLCLHash; + WriteLog (lsINFO, LedgerConsensus) << "CNF newLCL " << newLCLHash; Ledger::pointer newOL = boost::make_shared(true, boost::ref(*newLCL)); ScopedLock sl( theApp->getLedgerMaster().getLock()); @@ -1243,7 +1245,7 @@ void LedgerConsensus::accept(SHAMap::ref set, LoadEvent::pointer) { // we voted NO try { - WriteLog (lsDEBUG, LedgerConensus) << "Test applying disputed transaction that did not get in"; + WriteLog (lsDEBUG, LedgerConsensus) << "Test applying disputed transaction that did not get in"; SerializerIterator sit(it.second->peekTransaction()); SerializedTransaction::pointer txn = boost::make_shared(boost::ref(sit)); if (applyTransaction(engine, txn, newOL, true, false)) @@ -1251,12 +1253,12 @@ void LedgerConsensus::accept(SHAMap::ref set, LoadEvent::pointer) } catch (...) { - WriteLog (lsDEBUG, LedgerConensus) << "Failed to apply transaction we voted NO on"; + WriteLog (lsDEBUG, LedgerConsensus) << "Failed to apply transaction we voted NO on"; } } } - WriteLog (lsDEBUG, LedgerConensus) << "Applying transactions from current open ledger"; + WriteLog (lsDEBUG, LedgerConsensus) << "Applying transactions from current open ledger"; applyTransactions(theApp->getLedgerMaster().getCurrentLedger()->peekTransactionMap(), newOL, newLCL, failedTransactions, true); theApp->getLedgerMaster().pushLedger(newLCL, newOL, !mConsensusFail); @@ -1266,12 +1268,12 @@ void LedgerConsensus::accept(SHAMap::ref set, LoadEvent::pointer) if (mValidating) { // see how close our close time is to other node's close time reports - WriteLog (lsINFO, LedgerConensus) << "We closed at " << boost::lexical_cast(mCloseTime); + WriteLog (lsINFO, LedgerConsensus) << "We closed at " << boost::lexical_cast(mCloseTime); uint64 closeTotal = mCloseTime; int closeCount = 1; for (std::map::iterator it = mCloseTimes.begin(), end = mCloseTimes.end(); it != end; ++it) { // FIXME: Use median, not average - WriteLog (lsINFO, LedgerConensus) << boost::lexical_cast(it->second) << " time votes for " + WriteLog (lsINFO, LedgerConsensus) << boost::lexical_cast(it->second) << " time votes for " << boost::lexical_cast(it->first); closeCount += it->second; closeTotal += static_cast(it->first) * static_cast(it->second); @@ -1279,7 +1281,7 @@ void LedgerConsensus::accept(SHAMap::ref set, LoadEvent::pointer) closeTotal += (closeCount / 2); closeTotal /= closeCount; int offset = static_cast(closeTotal) - static_cast(mCloseTime); - WriteLog (lsINFO, LedgerConensus) << "Our close offset is estimated at " << offset << " (" << closeCount << ")"; + WriteLog (lsINFO, LedgerConsensus) << "Our close offset is estimated at " << offset << " (" << closeCount << ")"; theApp->getOPs().closeTimeOffset(offset); } @@ -1292,12 +1294,12 @@ void LedgerConsensus::endConsensus() void LedgerConsensus::simulate() { - WriteLog (lsINFO, LedgerConensus) << "Simulating consensus"; + WriteLog (lsINFO, LedgerConsensus) << "Simulating consensus"; closeLedger(); mCurrentMSeconds = 100; beginAccept(true); endConsensus(); - WriteLog (lsINFO, LedgerConensus) << "Simulation complete"; + WriteLog (lsINFO, LedgerConsensus) << "Simulation complete"; } Json::Value LedgerConsensus::getJson(bool full) diff --git a/src/cpp/ripple/LedgerEntrySet.cpp b/src/cpp/ripple/LedgerEntrySet.cpp index a2ada51d2..47625ac6e 100644 --- a/src/cpp/ripple/LedgerEntrySet.cpp +++ b/src/cpp/ripple/LedgerEntrySet.cpp @@ -1,5 +1,7 @@ +SETUP_LOG (LedgerEntrySet) + DECLARE_INSTANCE(LedgerEntrySetEntry); DECLARE_INSTANCE(LedgerEntrySet) diff --git a/src/cpp/ripple/LedgerMaster.cpp b/src/cpp/ripple/LedgerMaster.cpp index bae54dae7..2b9fac9a1 100644 --- a/src/cpp/ripple/LedgerMaster.cpp +++ b/src/cpp/ripple/LedgerMaster.cpp @@ -2,6 +2,8 @@ #define MIN_VALIDATION_RATIO 150 // 150/256ths of validations of previous ledger #define MAX_LEDGER_GAP 100 // Don't catch up more than 100 ledgers (cannot exceed 256) +SETUP_LOG (LedgerMaster) + uint32 LedgerMaster::getCurrentLedgerIndex() { return mCurrentLedger->getLedgerSeq(); diff --git a/src/cpp/ripple/LedgerTiming.cpp b/src/cpp/ripple/LedgerTiming.cpp index b9faa47ef..ab5fb767e 100644 --- a/src/cpp/ripple/LedgerTiming.cpp +++ b/src/cpp/ripple/LedgerTiming.cpp @@ -1,6 +1,7 @@ // VFALCO: Should rename ContinuousLedgerTiming to LedgerTiming -struct LedgerTiming; +struct LedgerTimingLog; +SETUP_LOG (LedgerTimingLog) // NOTE: First and last times must be repeated int ContinuousLedgerTiming::LedgerTimeResolution[] = { 10, 10, 20, 30, 60, 90, 120, 120 }; @@ -20,7 +21,7 @@ bool ContinuousLedgerTiming::shouldClose( if ((previousMSeconds < -1000) || (previousMSeconds > 600000) || (currentMSeconds < -1000) || (currentMSeconds > 600000)) { - WriteLog (lsWARNING, LedgerTiming) << + WriteLog (lsWARNING, LedgerTimingLog) << boost::str(boost::format("CLC::shouldClose range Trans=%s, Prop: %d/%d, Secs: %d (last:%d)") % (anyTransactions ? "yes" : "no") % previousProposers % proposersClosed % currentMSeconds % previousMSeconds); @@ -31,14 +32,14 @@ bool ContinuousLedgerTiming::shouldClose( { // no transactions so far this interval if (proposersClosed > (previousProposers / 4)) // did we miss a transaction? { - WriteLog (lsTRACE, LedgerTiming) << "no transactions, many proposers: now (" << proposersClosed << " closed, " + WriteLog (lsTRACE, LedgerTimingLog) << "no transactions, many proposers: now (" << proposersClosed << " closed, " << previousProposers << " before)"; return true; } #if 0 // This false triggers on the genesis ledger if (previousMSeconds > (1000 * (LEDGER_IDLE_INTERVAL + 2))) // the last ledger was very slow to close { - WriteLog (lsTRACE, LedgerTiming) << "was slow to converge (p=" << (previousMSeconds) << ")"; + WriteLog (lsTRACE, LedgerTimingLog) << "was slow to converge (p=" << (previousMSeconds) << ")"; if (previousMSeconds < 2000) return previousMSeconds; return previousMSeconds - 1000; @@ -49,13 +50,13 @@ bool ContinuousLedgerTiming::shouldClose( if ((openMSeconds < LEDGER_MIN_CLOSE) && ((proposersClosed + proposersValidated) < (previousProposers / 2 ))) { - WriteLog (lsDEBUG, LedgerTiming) << "Must wait minimum time before closing"; + WriteLog (lsDEBUG, LedgerTimingLog) << "Must wait minimum time before closing"; return false; } if ((currentMSeconds < previousMSeconds) && ((proposersClosed + proposersValidated) < previousProposers)) { - WriteLog (lsDEBUG, LedgerTiming) << "We are waiting for more closes/validations"; + WriteLog (lsDEBUG, LedgerTimingLog) << "We are waiting for more closes/validations"; return false; } @@ -74,7 +75,7 @@ bool ContinuousLedgerTiming::haveConsensus( bool forReal, // deciding whether to stop consensus process bool& failed) // we can't reach a consensus { - WriteLog (lsTRACE, LedgerTiming) << boost::str(boost::format("CLC::haveConsensus: prop=%d/%d agree=%d validated=%d time=%d/%d%s") % + WriteLog (lsTRACE, LedgerTimingLog) << boost::str(boost::format("CLC::haveConsensus: prop=%d/%d agree=%d validated=%d time=%d/%d%s") % currentProposers % previousProposers % currentAgree % currentFinished % currentAgreeTime % previousAgreeTime % (forReal ? "" : "X")); @@ -85,7 +86,7 @@ bool ContinuousLedgerTiming::haveConsensus( { // Less than 3/4 of the last ledger's proposers are present, we may need more time if (currentAgreeTime < (previousAgreeTime + LEDGER_MIN_CONSENSUS)) { - CondLog (forReal, lsTRACE, LedgerTiming) << "too fast, not enough proposers"; + CondLog (forReal, lsTRACE, LedgerTimingLog) << "too fast, not enough proposers"; return false; } } @@ -93,7 +94,7 @@ bool ContinuousLedgerTiming::haveConsensus( // If 80% of current proposers (plus us) agree on a set, we have consensus if (((currentAgree * 100 + 100) / (currentProposers + 1)) > 80) { - CondLog (forReal, lsINFO, LedgerTiming) << "normal consensus"; + CondLog (forReal, lsINFO, LedgerTimingLog) << "normal consensus"; failed = false; return true; } @@ -101,13 +102,13 @@ bool ContinuousLedgerTiming::haveConsensus( // If 80% of the nodes on your UNL have moved on, you should declare consensus if (((currentFinished * 100) / (currentProposers + 1)) > 80) { - CondLog (forReal, lsWARNING, LedgerTiming) << "We see no consensus, but 80% of nodes have moved on"; + CondLog (forReal, lsWARNING, LedgerTimingLog) << "We see no consensus, but 80% of nodes have moved on"; failed = true; return true; } // no consensus yet - CondLog (forReal, lsTRACE, LedgerTiming) << "no consensus"; + CondLog (forReal, lsTRACE, LedgerTimingLog) << "no consensus"; return false; } diff --git a/src/cpp/ripple/LoadManager.cpp b/src/cpp/ripple/LoadManager.cpp index ea5ed0acb..0bc6f64e1 100644 --- a/src/cpp/ripple/LoadManager.cpp +++ b/src/cpp/ripple/LoadManager.cpp @@ -8,6 +8,8 @@ #include "Config.h" #include "Application.h" +SETUP_LOG (LoadManager) + /* static volatile int* uptimePtr = NULL; diff --git a/src/cpp/ripple/LoadMonitor.cpp b/src/cpp/ripple/LoadMonitor.cpp index 7f47cbd3c..1cf64c09d 100644 --- a/src/cpp/ripple/LoadMonitor.cpp +++ b/src/cpp/ripple/LoadMonitor.cpp @@ -1,6 +1,8 @@ #include "LoadMonitor.h" #include "Log.h" +SETUP_LOG (LoadMonitor) + void LoadMonitor::update() { // call with the mutex int now = upTime(); diff --git a/src/cpp/ripple/Log.h b/src/cpp/ripple/Log.h index 4b89bc330..29c3d7965 100644 --- a/src/cpp/ripple/Log.h +++ b/src/cpp/ripple/Log.h @@ -56,20 +56,15 @@ public: private: /** Retrieve file name from a log partition. - - Key must have this shape: - - struct Key - { - static char const* getFileName (); - }; */ template - inline static LogPartition getFileName () + inline static char const* getFileName (); + /* { - // VFALCO: TODO, to implement this correctly get __FILE__ from Key - return __FILE__; + static_vfassert (false); } + */ + public: template inline static LogPartition const& get () @@ -79,6 +74,8 @@ public: } }; +#define SETUP_LOG(k) template <> char const* LogPartition::getFileName () { return __FILE__; } + //------------------------------------------------------------------------------ class Log diff --git a/src/cpp/ripple/NetworkOPs.cpp b/src/cpp/ripple/NetworkOPs.cpp index e175fe966..66cb83da3 100644 --- a/src/cpp/ripple/NetworkOPs.cpp +++ b/src/cpp/ripple/NetworkOPs.cpp @@ -12,6 +12,7 @@ #include "Log.h" #include "RippleAddress.h" +SETUP_LOG (NetworkOPs) // This is the primary interface into the "client" portion of the program. // Code that wants to do normal operations on the network such as diff --git a/src/cpp/ripple/OfferCancelTransactor.cpp b/src/cpp/ripple/OfferCancelTransactor.cpp index 59f169d20..c97f1cc0f 100644 --- a/src/cpp/ripple/OfferCancelTransactor.cpp +++ b/src/cpp/ripple/OfferCancelTransactor.cpp @@ -1,4 +1,6 @@ +SETUP_LOG (OfferCancelTransactor) + TER OfferCancelTransactor::doApply() { TER terResult; diff --git a/src/cpp/ripple/OfferCreateTransactor.cpp b/src/cpp/ripple/OfferCreateTransactor.cpp index 66fa615a0..821b33916 100644 --- a/src/cpp/ripple/OfferCreateTransactor.cpp +++ b/src/cpp/ripple/OfferCreateTransactor.cpp @@ -1,4 +1,6 @@ +SETUP_LOG (OfferCreateTransactor) + // Make sure an offer is still valid. If not, mark it unfunded. bool OfferCreateTransactor::bValidOffer( SLE::ref sleOfferDir, diff --git a/src/cpp/ripple/OrderBookDB.cpp b/src/cpp/ripple/OrderBookDB.cpp index 7d204ac8d..ce3bcbcbb 100644 --- a/src/cpp/ripple/OrderBookDB.cpp +++ b/src/cpp/ripple/OrderBookDB.cpp @@ -1,3 +1,4 @@ +SETUP_LOG (OrderBookDB) OrderBookDB::OrderBookDB() : mSeq(0) { diff --git a/src/cpp/ripple/PFRequest.cpp b/src/cpp/ripple/PFRequest.cpp index 531dd1ab8..90bde6326 100644 --- a/src/cpp/ripple/PFRequest.cpp +++ b/src/cpp/ripple/PFRequest.cpp @@ -8,6 +8,8 @@ #include "RippleCalc.h" #include "LedgerFormats.h" +SETUP_LOG (PFRequest) + boost::recursive_mutex PFRequest::sLock; std::set PFRequest::sRequests; diff --git a/src/cpp/ripple/ParseSection.cpp b/src/cpp/ripple/ParseSection.cpp index 8be2648f6..b31e6e604 100644 --- a/src/cpp/ripple/ParseSection.cpp +++ b/src/cpp/ripple/ParseSection.cpp @@ -9,9 +9,9 @@ #define SECTION_DEFAULT_NAME "" // for logging -struct ParseSectionLog -{ -}; +struct ParseSectionLog { }; + +SETUP_LOG (ParseSectionLog) section ParseSection(const std::string& strInput, const bool bTrim) { diff --git a/src/cpp/ripple/Pathfinder.cpp b/src/cpp/ripple/Pathfinder.cpp index 2919b5b54..65862e628 100644 --- a/src/cpp/ripple/Pathfinder.cpp +++ b/src/cpp/ripple/Pathfinder.cpp @@ -8,6 +8,8 @@ #include "Application.h" #include "Log.h" +SETUP_LOG (Pathfinder) + /* we just need to find a succession of the highest quality paths there until we find enough width diff --git a/src/cpp/ripple/PaymentTransactor.cpp b/src/cpp/ripple/PaymentTransactor.cpp index 80aa15bd4..11b292a15 100644 --- a/src/cpp/ripple/PaymentTransactor.cpp +++ b/src/cpp/ripple/PaymentTransactor.cpp @@ -1,4 +1,6 @@ +SETUP_LOG (PaymentTransactor) + #define RIPPLE_PATHS_MAX 6 TER PaymentTransactor::doApply() diff --git a/src/cpp/ripple/Peer.cpp b/src/cpp/ripple/Peer.cpp index 43297df81..1ce87dfcf 100644 --- a/src/cpp/ripple/Peer.cpp +++ b/src/cpp/ripple/Peer.cpp @@ -15,6 +15,8 @@ #include "utils.h" #include "Log.h" +SETUP_LOG (Peer) + DECLARE_INSTANCE(Peer); // Don't try to run past receiving nonsense from a peer diff --git a/src/cpp/ripple/PeerDoor.cpp b/src/cpp/ripple/PeerDoor.cpp index 84af9693d..06f1ce968 100644 --- a/src/cpp/ripple/PeerDoor.cpp +++ b/src/cpp/ripple/PeerDoor.cpp @@ -11,6 +11,8 @@ #include "utils.h" #include "Log.h" +SETUP_LOG (PeerDoor) + using namespace std; using namespace boost::asio::ip; diff --git a/src/cpp/ripple/ProofOfWork.cpp b/src/cpp/ripple/ProofOfWork.cpp index 16368f326..88600f068 100644 --- a/src/cpp/ripple/ProofOfWork.cpp +++ b/src/cpp/ripple/ProofOfWork.cpp @@ -12,6 +12,7 @@ #include "Serializer.h" #include "Log.h" +SETUP_LOG (ProofOfWork) bool powResultInfo(POWResult powCode, std::string& strToken, std::string& strHuman) { diff --git a/src/cpp/ripple/RPCDoor.cpp b/src/cpp/ripple/RPCDoor.cpp index c6bb17bad..3dfe81c7b 100644 --- a/src/cpp/ripple/RPCDoor.cpp +++ b/src/cpp/ripple/RPCDoor.cpp @@ -5,6 +5,8 @@ #include #include +SETUP_LOG (RPCDoor) + using namespace std; using namespace boost::asio::ip; diff --git a/src/cpp/ripple/RPCErr.cpp b/src/cpp/ripple/RPCErr.cpp index 9b51968be..91b7b58d0 100644 --- a/src/cpp/ripple/RPCErr.cpp +++ b/src/cpp/ripple/RPCErr.cpp @@ -7,9 +7,9 @@ #include "../json/writer.h" // For logging -struct RPCErr -{ -}; +struct RPCErr { }; + +SETUP_LOG (RPCErr) Json::Value rpcError(int iError, Json::Value jvResult) { diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index efe296e10..eaf1be1b5 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -25,6 +25,8 @@ #include "PFRequest.h" #include "ProofOfWork.h" +SETUP_LOG (RPCHandler) + static const int rpcCOST_DEFAULT = 10; static const int rpcCOST_EXCEPTION = 20; static const int rpcCOST_EXPENSIVE = 50; diff --git a/src/cpp/ripple/RPCServer.cpp b/src/cpp/ripple/RPCServer.cpp index eb6063fd0..5aa8e24b6 100644 --- a/src/cpp/ripple/RPCServer.cpp +++ b/src/cpp/ripple/RPCServer.cpp @@ -21,6 +21,8 @@ #define RPC_MAXIMUM_QUERY (1024*1024) #endif +SETUP_LOG (RPCServer) + RPCServer::RPCServer(boost::asio::io_service& io_service , NetworkOPs* nopNetwork) : mNetOps(nopNetwork), mSocket(io_service) { diff --git a/src/cpp/ripple/RPCSub.cpp b/src/cpp/ripple/RPCSub.cpp index d04b483af..6028eda30 100644 --- a/src/cpp/ripple/RPCSub.cpp +++ b/src/cpp/ripple/RPCSub.cpp @@ -5,6 +5,8 @@ #include "CallRPC.h" +SETUP_LOG (RPCSub) + RPCSub::RPCSub(const std::string& strUrl, const std::string& strUsername, const std::string& strPassword) : mUrl(strUrl), mSSL(false), mUsername(strUsername), mPassword(strPassword), mSending(false) { diff --git a/src/cpp/ripple/RangeSet.cpp b/src/cpp/ripple/RangeSet.cpp index 93a471a84..8e782a6e6 100644 --- a/src/cpp/ripple/RangeSet.cpp +++ b/src/cpp/ripple/RangeSet.cpp @@ -6,6 +6,8 @@ #include "Log.h" +SETUP_LOG (RangeSet) + inline uint32 min(uint32 x, uint32 y) { return (x < y) ? x : y; } inline uint32 max(uint32 x, uint32 y) { return (x > y) ? x : y; } diff --git a/src/cpp/ripple/RegularKeySetTransactor.cpp b/src/cpp/ripple/RegularKeySetTransactor.cpp index bc8e850e4..86f49218d 100644 --- a/src/cpp/ripple/RegularKeySetTransactor.cpp +++ b/src/cpp/ripple/RegularKeySetTransactor.cpp @@ -1,4 +1,6 @@ +SETUP_LOG (RegularKeySetTransactor) + uint64 RegularKeySetTransactor::calculateBaseFee() { if ( !(mTxnAccount->getFlags() & lsfPasswordSpent) diff --git a/src/cpp/ripple/RippleAddress.cpp b/src/cpp/ripple/RippleAddress.cpp index 2608428b8..9046b23d5 100644 --- a/src/cpp/ripple/RippleAddress.cpp +++ b/src/cpp/ripple/RippleAddress.cpp @@ -21,6 +21,8 @@ #include "Serializer.h" #include "Application.h" +SETUP_LOG (RippleAddress) + std::size_t hash_value(const CBase58Data& b58) { std::size_t seed = theApp->getNonceST() + (b58.nVersion * 0x9e3779b9); diff --git a/src/cpp/ripple/RippleCalc.cpp b/src/cpp/ripple/RippleCalc.cpp index c9ce3d51c..83fbef624 100644 --- a/src/cpp/ripple/RippleCalc.cpp +++ b/src/cpp/ripple/RippleCalc.cpp @@ -5,6 +5,7 @@ // all liquidity is used. // +SETUP_LOG (RippleCalc) std::size_t hash_value(const aciSource& asValue) { diff --git a/src/cpp/ripple/SHAMap.cpp b/src/cpp/ripple/SHAMap.cpp index 8e9bcfb89..42a8f08be 100644 --- a/src/cpp/ripple/SHAMap.cpp +++ b/src/cpp/ripple/SHAMap.cpp @@ -19,6 +19,8 @@ #define STATE_MAP_BUCKETS 1024 #endif +SETUP_LOG (SHAMap) + DECLARE_INSTANCE(SHAMap); DECLARE_INSTANCE(SHAMapItem); DECLARE_INSTANCE(SHAMapTreeNode); diff --git a/src/cpp/ripple/SHAMapNodes.cpp b/src/cpp/ripple/SHAMapNodes.cpp index cc25e65c0..e8945d4f1 100644 --- a/src/cpp/ripple/SHAMapNodes.cpp +++ b/src/cpp/ripple/SHAMapNodes.cpp @@ -16,6 +16,8 @@ #include "Log.h" #include "HashPrefixes.h" +SETUP_LOG (SHAMapNode) + std::string SHAMapNode::getString() const { static boost::format NodeID("NodeID(%s,%s)"); diff --git a/src/cpp/ripple/SNTPClient.cpp b/src/cpp/ripple/SNTPClient.cpp index 1d17facf8..b9ed80c2d 100644 --- a/src/cpp/ripple/SNTPClient.cpp +++ b/src/cpp/ripple/SNTPClient.cpp @@ -10,6 +10,8 @@ #include "Config.h" #include "Log.h" +SETUP_LOG (SNTPClient) + // #define SNTP_DEBUG static uint8_t SNTPQueryData[48] = diff --git a/src/cpp/ripple/SerializedLedger.cpp b/src/cpp/ripple/SerializedLedger.cpp index 7f616e229..72d72e77f 100644 --- a/src/cpp/ripple/SerializedLedger.cpp +++ b/src/cpp/ripple/SerializedLedger.cpp @@ -1,9 +1,10 @@ DECLARE_INSTANCE(SerializedLedgerEntry) -struct SerializedLedger -{ -}; +// For logging +struct SerializedLedgerLog { }; + +SETUP_LOG (SerializedLedgerLog) SerializedLedgerEntry::SerializedLedgerEntry(SerializerIterator& sit, const uint256& index) : STObject(sfLedgerEntry), mIndex(index), mMutable(true) @@ -31,8 +32,8 @@ SerializedLedgerEntry::SerializedLedgerEntry(const Serializer& s, const uint256& mType = mFormat->t_type; if (!setType(mFormat->elements)) { - WriteLog (lsWARNING, SerializedLedger) << "Ledger entry not valid for type " << mFormat->t_name; - WriteLog (lsWARNING, SerializedLedger) << getJson(0); + WriteLog (lsWARNING, SerializedLedgerLog) << "Ledger entry not valid for type " << mFormat->t_name; + WriteLog (lsWARNING, SerializedLedgerLog) << getJson(0); throw std::runtime_error("ledger entry not valid for type"); } } @@ -104,7 +105,7 @@ uint32 SerializedLedgerEntry::getThreadedLedger() bool SerializedLedgerEntry::thread(const uint256& txID, uint32 ledgerSeq, uint256& prevTxID, uint32& prevLedgerID) { uint256 oldPrevTxID = getFieldH256(sfPreviousTxnID); - WriteLog (lsTRACE, SerializedLedger) << "Thread Tx:" << txID << " prev:" << oldPrevTxID; + WriteLog (lsTRACE, SerializedLedgerLog) << "Thread Tx:" << txID << " prev:" << oldPrevTxID; if (oldPrevTxID == txID) { // this transaction is already threaded assert(getFieldU32(sfPreviousTxnLgrSeq) == ledgerSeq); diff --git a/src/cpp/ripple/SerializedObject.cpp b/src/cpp/ripple/SerializedObject.cpp index 6e65fca2f..77d1e3e65 100644 --- a/src/cpp/ripple/SerializedObject.cpp +++ b/src/cpp/ripple/SerializedObject.cpp @@ -1,4 +1,6 @@ +SETUP_LOG (STObject) + DECLARE_INSTANCE(SerializedObject); DECLARE_INSTANCE(SerializedArray); diff --git a/src/cpp/ripple/SerializedTransaction.cpp b/src/cpp/ripple/SerializedTransaction.cpp index f6a923910..24bc5ad51 100644 --- a/src/cpp/ripple/SerializedTransaction.cpp +++ b/src/cpp/ripple/SerializedTransaction.cpp @@ -1,4 +1,6 @@ +SETUP_LOG (SerializedTransaction) + DECLARE_INSTANCE(SerializedTransaction); SerializedTransaction::SerializedTransaction(TransactionType type) : STObject(sfTransaction), mType(type), diff --git a/src/cpp/ripple/SerializedTypes.cpp b/src/cpp/ripple/SerializedTypes.cpp index 379b4001d..ca983f2b9 100644 --- a/src/cpp/ripple/SerializedTypes.cpp +++ b/src/cpp/ripple/SerializedTypes.cpp @@ -1,4 +1,6 @@ +SETUP_LOG (SerializedType) + const STAmount saZero(CURRENCY_ONE, ACCOUNT_ONE, 0); const STAmount saOne(CURRENCY_ONE, ACCOUNT_ONE, 1); diff --git a/src/cpp/ripple/Serializer.cpp b/src/cpp/ripple/Serializer.cpp index 99ebed9be..59d9de09d 100644 --- a/src/cpp/ripple/Serializer.cpp +++ b/src/cpp/ripple/Serializer.cpp @@ -1,4 +1,6 @@ +SETUP_LOG (Serializer) + int Serializer::addZeros(size_t uBytes) { int ret = mData.size(); diff --git a/src/cpp/ripple/TransactionAcquire.cpp b/src/cpp/ripple/TransactionAcquire.cpp index 7dddbd2f0..79a309c27 100644 --- a/src/cpp/ripple/TransactionAcquire.cpp +++ b/src/cpp/ripple/TransactionAcquire.cpp @@ -1,4 +1,6 @@ +SETUP_LOG (TransactionAcquire) + #define TX_ACQUIRE_TIMEOUT 250 typedef std::map::value_type u160_prop_pair; diff --git a/src/cpp/ripple/TransactionEngine.cpp b/src/cpp/ripple/TransactionEngine.cpp index 584ea9f8b..5d539979f 100644 --- a/src/cpp/ripple/TransactionEngine.cpp +++ b/src/cpp/ripple/TransactionEngine.cpp @@ -2,6 +2,8 @@ // XXX Make sure all fields are recognized in transactions. // +SETUP_LOG (TransactionEngine) + DECLARE_INSTANCE(TransactionEngine); diff --git a/src/cpp/ripple/TransactionMeta.cpp b/src/cpp/ripple/TransactionMeta.cpp index 2cb4c1cff..3377158b5 100644 --- a/src/cpp/ripple/TransactionMeta.cpp +++ b/src/cpp/ripple/TransactionMeta.cpp @@ -1,6 +1,8 @@ // VFALCO: TODO, rename class to TransactionMeta +SETUP_LOG (TransactionMetaSet) + TransactionMetaSet::TransactionMetaSet(const uint256& txid, uint32 ledger, const std::vector& vec) : mTransactionID(txid), mLedger(ledger), mNodes(sfAffectedNodes, 32) { diff --git a/src/cpp/ripple/Transactor.cpp b/src/cpp/ripple/Transactor.cpp index afc161f21..be4366d7b 100644 --- a/src/cpp/ripple/Transactor.cpp +++ b/src/cpp/ripple/Transactor.cpp @@ -1,4 +1,6 @@ +SETUP_LOG (Transactor) + UPTR_T Transactor::makeTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) { switch(txn.getTxnType()) diff --git a/src/cpp/ripple/TrustSetTransactor.cpp b/src/cpp/ripple/TrustSetTransactor.cpp index 8db30a668..6ac24adbd 100644 --- a/src/cpp/ripple/TrustSetTransactor.cpp +++ b/src/cpp/ripple/TrustSetTransactor.cpp @@ -1,4 +1,6 @@ +SETUP_LOG (TrustSetTransactor) + TER TrustSetTransactor::doApply() { TER terResult = tesSUCCESS; diff --git a/src/cpp/ripple/UniqueNodeList.cpp b/src/cpp/ripple/UniqueNodeList.cpp index 86e36c430..c6dcdb6d4 100644 --- a/src/cpp/ripple/UniqueNodeList.cpp +++ b/src/cpp/ripple/UniqueNodeList.cpp @@ -39,6 +39,8 @@ #define REFERRAL_VALIDATORS_MAX 50 #define REFERRAL_IPS_MAX 50 +SETUP_LOG (UniqueNodeList) + UniqueNodeList::UniqueNodeList(boost::asio::io_service& io_service) : mdtScoreTimer(io_service), mFetchActive(0), diff --git a/src/cpp/ripple/ValidationCollection.cpp b/src/cpp/ripple/ValidationCollection.cpp index 54b7a069e..2dbebc766 100644 --- a/src/cpp/ripple/ValidationCollection.cpp +++ b/src/cpp/ripple/ValidationCollection.cpp @@ -7,6 +7,8 @@ #include "LedgerTiming.h" #include "Log.h" +SETUP_LOG (ValidationCollection) + typedef std::map::value_type u160_val_pair; typedef boost::shared_ptr VSpointer; diff --git a/src/cpp/ripple/WSConnection.h b/src/cpp/ripple/WSConnection.h index a9ee8845d..7f4ca48b1 100644 --- a/src/cpp/ripple/WSConnection.h +++ b/src/cpp/ripple/WSConnection.h @@ -21,9 +21,9 @@ DEFINE_INSTANCE(WebSocketConnection); // This is for logging -struct WSConnectionLog -{ -}; +struct WSConnectionLog { }; + +SETUP_LOG (WSConnectionLog) template class WSServerHandler; diff --git a/src/cpp/ripple/WSDoor.cpp b/src/cpp/ripple/WSDoor.cpp index d3a11227a..c9658afaa 100644 --- a/src/cpp/ripple/WSDoor.cpp +++ b/src/cpp/ripple/WSDoor.cpp @@ -22,6 +22,8 @@ #include #include +SETUP_LOG (WSDoor) + DECLARE_INSTANCE(WebSocketConnection); // diff --git a/src/cpp/ripple/WSHandler.h b/src/cpp/ripple/WSHandler.h index ae3f65209..44dbe22d7 100644 --- a/src/cpp/ripple/WSHandler.h +++ b/src/cpp/ripple/WSHandler.h @@ -17,6 +17,8 @@ struct WSServerHandlerLog // for logging { }; +SETUP_LOG (WSServerHandlerLog) + // A single instance of this object is made. // This instance dispatches all events. There is no per connection persistence. diff --git a/src/cpp/ripple/WalletAddTransactor.cpp b/src/cpp/ripple/WalletAddTransactor.cpp index 2081d9872..73011d975 100644 --- a/src/cpp/ripple/WalletAddTransactor.cpp +++ b/src/cpp/ripple/WalletAddTransactor.cpp @@ -1,3 +1,5 @@ +SETUP_LOG (WalletAddTransactor) + TER WalletAddTransactor::doApply() { std::cerr << "WalletAdd>" << std::endl; diff --git a/src/cpp/ripple/rpc.cpp b/src/cpp/ripple/rpc.cpp index 309d1bf1b..92b98602b 100644 --- a/src/cpp/ripple/rpc.cpp +++ b/src/cpp/ripple/rpc.cpp @@ -22,6 +22,8 @@ struct RPC { }; +SETUP_LOG (RPC) + using namespace boost; using namespace boost::asio;