mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 22:45:52 +00:00
Logging cleanups.
This commit is contained in:
@@ -277,7 +277,7 @@ bool STAmount::setValue(const std::string& sAmount)
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Log(lsINFO) << "Bad integer amount: " << sAmount;
|
||||
cLog(lsINFO) << "Bad integer amount: " << sAmount;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -304,7 +304,7 @@ bool STAmount::setValue(const std::string& sAmount)
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Log(lsINFO) << "Bad e amount: " << sAmount;
|
||||
cLog(lsINFO) << "Bad e amount: " << sAmount;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -346,7 +346,7 @@ bool STAmount::setValue(const std::string& sAmount)
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Log(lsINFO) << "Bad float amount: " << sAmount;
|
||||
cLog(lsINFO) << "Bad float amount: " << sAmount;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -391,7 +391,7 @@ bool STAmount::setFullValue(const std::string& sAmount, const std::string& sCurr
|
||||
//
|
||||
if (!currencyFromString(mCurrency, sCurrency))
|
||||
{
|
||||
Log(lsINFO) << "Currency malformed: " << sCurrency;
|
||||
cLog(lsINFO) << "Currency malformed: " << sCurrency;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -406,7 +406,7 @@ bool STAmount::setFullValue(const std::string& sAmount, const std::string& sCurr
|
||||
// Issuer must be "" or a valid account string.
|
||||
if (!naIssuerID.setAccountID(sIssuer))
|
||||
{
|
||||
Log(lsINFO) << "Issuer malformed: " << sIssuer;
|
||||
cLog(lsINFO) << "Issuer malformed: " << sIssuer;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -416,7 +416,7 @@ bool STAmount::setFullValue(const std::string& sAmount, const std::string& sCurr
|
||||
// Stamps not must have an issuer.
|
||||
if (mIsNative && !mIssuer.isZero())
|
||||
{
|
||||
Log(lsINFO) << "Issuer specified for XRP: " << sIssuer;
|
||||
cLog(lsINFO) << "Issuer specified for XRP: " << sIssuer;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1050,7 +1050,7 @@ bool STAmount::applyOffer(
|
||||
saTakerPaid = saOfferGets; // Taker paid what offer could get.
|
||||
saTakerGot = saOfferPays; // Taker got what offer could pay.
|
||||
|
||||
Log(lsINFO) << "applyOffer: took all outright";
|
||||
cLog(lsINFO) << "applyOffer: took all outright";
|
||||
}
|
||||
else if (saTakerFunds >= saOfferGetsAvailable)
|
||||
{
|
||||
@@ -1058,7 +1058,7 @@ bool STAmount::applyOffer(
|
||||
saTakerPaid = saOfferGetsAvailable; // Taker paid what offer could get.
|
||||
saTakerGot = saOfferPaysAvailable; // Taker got what offer could pay.
|
||||
|
||||
Log(lsINFO) << "applyOffer: took all available";
|
||||
cLog(lsINFO) << "applyOffer: took all available";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1066,8 +1066,8 @@ bool STAmount::applyOffer(
|
||||
saTakerPaid = saTakerFunds; // Taker paid all he had.
|
||||
saTakerGot = divide(multiply(saTakerFunds, saOfferPaysAvailable, CURRENCY_ONE, ACCOUNT_ONE), saOfferGetsAvailable, saOfferPays.getCurrency(), saOfferPays.getIssuer());
|
||||
|
||||
Log(lsINFO) << "applyOffer: saTakerGot=" << saTakerGot.getFullText();
|
||||
Log(lsINFO) << "applyOffer: saOfferPaysAvailable=" << saOfferPaysAvailable.getFullText();
|
||||
cLog(lsINFO) << "applyOffer: saTakerGot=" << saTakerGot.getFullText();
|
||||
cLog(lsINFO) << "applyOffer: saOfferPaysAvailable=" << saOfferPaysAvailable.getFullText();
|
||||
}
|
||||
|
||||
if (uTakerPaysRate == QUALITY_ONE)
|
||||
@@ -1394,7 +1394,7 @@ BOOST_AUTO_TEST_CASE( CustomCurrency_test )
|
||||
BOOST_FAIL("STAmount multiply fail");
|
||||
if (STAmount::divide(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 60), STAmount(3), CURRENCY_ONE, ACCOUNT_ONE).getText() != "20")
|
||||
{
|
||||
Log(lsFATAL) << "60/3 = " <<
|
||||
cLog(lsFATAL) << "60/3 = " <<
|
||||
STAmount::divide(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 60),
|
||||
STAmount(3), CURRENCY_ONE, ACCOUNT_ONE).getText();
|
||||
BOOST_FAIL("STAmount divide fail");
|
||||
@@ -1449,7 +1449,7 @@ static void mulTest(int a, int b)
|
||||
STAmount prod2(CURRENCY_ONE, ACCOUNT_ONE, static_cast<uint64>(a) * static_cast<uint64>(b));
|
||||
if (prod1 != prod2)
|
||||
{
|
||||
Log(lsWARNING) << "nn(" << aa.getFullText() << " * " << bb.getFullText() << ") = " << prod1.getFullText()
|
||||
cLog(lsWARNING) << "nn(" << aa.getFullText() << " * " << bb.getFullText() << ") = " << prod1.getFullText()
|
||||
<< " not " << prod2.getFullText();
|
||||
BOOST_WARN("Multiplication result is not exact");
|
||||
}
|
||||
@@ -1457,7 +1457,7 @@ static void mulTest(int a, int b)
|
||||
prod1 = STAmount::multiply(aa, bb, CURRENCY_ONE, ACCOUNT_ONE);
|
||||
if (prod1 != prod2)
|
||||
{
|
||||
Log(lsWARNING) << "n(" << aa.getFullText() << " * " << bb.getFullText() << ") = " << prod1.getFullText()
|
||||
cLog(lsWARNING) << "n(" << aa.getFullText() << " * " << bb.getFullText() << ") = " << prod1.getFullText()
|
||||
<< " not " << prod2.getFullText();
|
||||
BOOST_WARN("Multiplication result is not exact");
|
||||
}
|
||||
|
||||
@@ -1232,10 +1232,10 @@ void LedgerConsensus::accept(SHAMap::ref set, LoadEvent::pointer)
|
||||
|
||||
if (sLog(lsTRACE))
|
||||
{
|
||||
Log(lsTRACE) << "newLCL";
|
||||
cLog(lsTRACE) << "newLCL";
|
||||
Json::Value p;
|
||||
newLCL->addJson(p, LEDGER_JSON_DUMP_TXRP | LEDGER_JSON_DUMP_STATE);
|
||||
Log(lsTRACE) << p;
|
||||
cLog(lsTRACE) << p;
|
||||
}
|
||||
|
||||
statusChange(ripple::neACCEPTED_LEDGER, *newLCL);
|
||||
|
||||
@@ -1006,7 +1006,7 @@ Json::Value RPCHandler::doSubmit(Json::Value jvRequest)
|
||||
{
|
||||
naMasterAccountPublic.setAccountPublic(naMasterGenerator, iIndex);
|
||||
|
||||
Log(lsWARNING) << "authorize: " << iIndex << " : " << naMasterAccountPublic.humanAccountID() << " : " << raSrcAddressID.humanAccountID();
|
||||
cLog(lsWARNING) << "authorize: " << iIndex << " : " << naMasterAccountPublic.humanAccountID() << " : " << raSrcAddressID.humanAccountID();
|
||||
|
||||
bFound = raSrcAddressID.getAccountID() == naMasterAccountPublic.getAccountID();
|
||||
if (!bFound)
|
||||
|
||||
@@ -707,7 +707,7 @@ SHAMapTreeNode::pointer SHAMap::fetchNodeExternal(const SHAMapNode& id, const ui
|
||||
HashedObject::pointer obj(theApp->getHashedObjectStore().retrieve(hash));
|
||||
if (!obj)
|
||||
{
|
||||
// Log(lsTRACE) << "fetchNodeExternal: missing " << hash;
|
||||
// cLog(lsTRACE) << "fetchNodeExternal: missing " << hash;
|
||||
throw SHAMapMissingNode(mType, id, hash);
|
||||
}
|
||||
|
||||
@@ -716,13 +716,13 @@ SHAMapTreeNode::pointer SHAMap::fetchNodeExternal(const SHAMapNode& id, const ui
|
||||
SHAMapTreeNode::pointer ret = boost::make_shared<SHAMapTreeNode>(id, obj->getData(), mSeq - 1, snfPREFIX);
|
||||
if (id != *ret)
|
||||
{
|
||||
Log(lsFATAL) << "id:" << id << ", got:" << *ret;
|
||||
cLog(lsFATAL) << "id:" << id << ", got:" << *ret;
|
||||
assert(false);
|
||||
return SHAMapTreeNode::pointer();
|
||||
}
|
||||
if (ret->getNodeHash() != hash)
|
||||
{
|
||||
Log(lsFATAL) << "Hashes don't match";
|
||||
cLog(lsFATAL) << "Hashes don't match";
|
||||
assert(false);
|
||||
return SHAMapTreeNode::pointer();
|
||||
}
|
||||
@@ -745,11 +745,11 @@ void SHAMap::fetchRoot(const uint256& hash)
|
||||
if (sLog(lsTRACE))
|
||||
{
|
||||
if (mType == smtTRANSACTION)
|
||||
Log(lsTRACE) << "Fetch root TXN node " << hash;
|
||||
cLog(lsTRACE) << "Fetch root TXN node " << hash;
|
||||
else if (mType == smtSTATE)
|
||||
Log(lsTRACE) << "Fetch root STATE node " << hash;
|
||||
cLog(lsTRACE) << "Fetch root STATE node " << hash;
|
||||
else
|
||||
Log(lsTRACE) << "Fetch root SHAMap node " << hash;
|
||||
cLog(lsTRACE) << "Fetch root SHAMap node " << hash;
|
||||
}
|
||||
root = fetchNodeExternal(SHAMapNode(), hash);
|
||||
assert(root->getNodeHash() == hash);
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "Log.h"
|
||||
#include "HashPrefixes.h"
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
std::string SHAMapNode::getString() const
|
||||
{
|
||||
static boost::format NodeID("NodeID(%s,%s)");
|
||||
@@ -170,7 +172,7 @@ int SHAMapNode::selectBranch(const uint256& hash) const
|
||||
|
||||
void SHAMapNode::dump() const
|
||||
{
|
||||
Log(lsDEBUG) << getString();
|
||||
cLog(lsDEBUG) << getString();
|
||||
}
|
||||
|
||||
SHAMapTreeNode::SHAMapTreeNode(uint32 seq, const SHAMapNode& nodeID) : SHAMapNode(nodeID), mHash(0),
|
||||
@@ -265,7 +267,7 @@ SHAMapTreeNode::SHAMapTreeNode(const SHAMapNode& id, const std::vector<unsigned
|
||||
{
|
||||
if (rawNode.size() < 4)
|
||||
{
|
||||
Log(lsINFO) << "size < 4";
|
||||
cLog(lsINFO) << "size < 4";
|
||||
throw std::runtime_error("invalid P node");
|
||||
}
|
||||
|
||||
@@ -287,7 +289,7 @@ SHAMapTreeNode::SHAMapTreeNode(const SHAMapNode& id, const std::vector<unsigned
|
||||
s.chop(32);
|
||||
if (u.isZero())
|
||||
{
|
||||
Log(lsINFO) << "invalid PLN node";
|
||||
cLog(lsINFO) << "invalid PLN node";
|
||||
throw std::runtime_error("invalid PLN node");
|
||||
}
|
||||
mItem = boost::make_shared<SHAMapItem>(u, s.peekData());
|
||||
@@ -313,7 +315,7 @@ SHAMapTreeNode::SHAMapTreeNode(const SHAMapNode& id, const std::vector<unsigned
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(lsINFO) << "Unknown node prefix " << std::hex << prefix << std::dec;
|
||||
cLog(lsINFO) << "Unknown node prefix " << std::hex << prefix << std::dec;
|
||||
throw std::runtime_error("invalid node prefix");
|
||||
}
|
||||
}
|
||||
@@ -510,7 +512,7 @@ void SHAMapTreeNode::makeInner()
|
||||
|
||||
void SHAMapTreeNode::dump()
|
||||
{
|
||||
Log(lsDEBUG) << "SHAMapTreeNode(" << getNodeID() << ")";
|
||||
cLog(lsDEBUG) << "SHAMapTreeNode(" << getNodeID() << ")";
|
||||
}
|
||||
|
||||
std::string SHAMapTreeNode::getString() const
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "Config.h"
|
||||
#include "Log.h"
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
// #define SNTP_DEBUG
|
||||
|
||||
static uint8_t SNTPQueryData[48] =
|
||||
@@ -73,7 +75,7 @@ void SNTPClient::resolveComplete(const boost::system::error_code& error, boost::
|
||||
time_t now = time(NULL);
|
||||
if ((query.mLocalTimeSent == now) || ((query.mLocalTimeSent + 1) == now))
|
||||
{ // This can happen if the same IP address is reached through multiple names
|
||||
Log(lsTRACE) << "SNTP: Redundant query suppressed";
|
||||
cLog(lsTRACE) << "SNTP: Redundant query suppressed";
|
||||
return;
|
||||
}
|
||||
query.mReceivedReply = false;
|
||||
@@ -94,23 +96,23 @@ void SNTPClient::receivePacket(const boost::system::error_code& error, std::size
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
#ifdef SNTP_DEBUG
|
||||
Log(lsTRACE) << "SNTP: Packet from " << mReceiveEndpoint;
|
||||
cLog(lsTRACE) << "SNTP: Packet from " << mReceiveEndpoint;
|
||||
#endif
|
||||
std::map<boost::asio::ip::udp::endpoint, SNTPQuery>::iterator query = mQueries.find(mReceiveEndpoint);
|
||||
if (query == mQueries.end())
|
||||
Log(lsDEBUG) << "SNTP: Reply from " << mReceiveEndpoint << " found without matching query";
|
||||
cLog(lsDEBUG) << "SNTP: Reply from " << mReceiveEndpoint << " found without matching query";
|
||||
else if (query->second.mReceivedReply)
|
||||
Log(lsDEBUG) << "SNTP: Duplicate response from " << mReceiveEndpoint;
|
||||
cLog(lsDEBUG) << "SNTP: Duplicate response from " << mReceiveEndpoint;
|
||||
else
|
||||
{
|
||||
query->second.mReceivedReply = true;
|
||||
if (time(NULL) > (query->second.mLocalTimeSent + 1))
|
||||
Log(lsWARNING) << "SNTP: Late response from " << mReceiveEndpoint;
|
||||
cLog(lsWARNING) << "SNTP: Late response from " << mReceiveEndpoint;
|
||||
else if (bytes_xferd < 48)
|
||||
Log(lsWARNING) << "SNTP: Short reply from " << mReceiveEndpoint
|
||||
cLog(lsWARNING) << "SNTP: Short reply from " << mReceiveEndpoint
|
||||
<< " (" << bytes_xferd << ") " << mReceiveBuffer.size();
|
||||
else if (reinterpret_cast<uint32*>(&mReceiveBuffer[0])[NTP_OFF_ORGTS_FRAC] != query->second.mQueryNonce)
|
||||
Log(lsWARNING) << "SNTP: Reply from " << mReceiveEndpoint << "had wrong nonce";
|
||||
cLog(lsWARNING) << "SNTP: Reply from " << mReceiveEndpoint << "had wrong nonce";
|
||||
else
|
||||
processReply();
|
||||
}
|
||||
@@ -123,8 +125,7 @@ void SNTPClient::receivePacket(const boost::system::error_code& error, std::size
|
||||
|
||||
void SNTPClient::sendComplete(const boost::system::error_code& error, std::size_t)
|
||||
{
|
||||
if (error)
|
||||
Log(lsWARNING) << "SNTP: Send error";
|
||||
tLog(error, lsWARNING) << "SNTP: Send error";
|
||||
}
|
||||
|
||||
void SNTPClient::processReply()
|
||||
@@ -138,12 +139,12 @@ void SNTPClient::processReply()
|
||||
|
||||
if ((info >> 30) == 3)
|
||||
{
|
||||
Log(lsINFO) << "SNTP: Alarm condition " << mReceiveEndpoint;
|
||||
cLog(lsINFO) << "SNTP: Alarm condition " << mReceiveEndpoint;
|
||||
return;
|
||||
}
|
||||
if ((stratum == 0) || (stratum > 14))
|
||||
{
|
||||
Log(lsINFO) << "SNTP: Unreasonable stratum (" << stratum << ") from " << mReceiveEndpoint;
|
||||
cLog(lsINFO) << "SNTP: Unreasonable stratum (" << stratum << ") from " << mReceiveEndpoint;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -171,10 +172,7 @@ void SNTPClient::processReply()
|
||||
if ((mOffset == -1) || (mOffset == 1)) // small corrections likely do more harm than good
|
||||
mOffset = 0;
|
||||
|
||||
#ifndef SNTP_DEBUG
|
||||
if (timev || mOffset)
|
||||
#endif
|
||||
Log(lsTRACE) << "SNTP: Offset is " << timev << ", new system offset is " << mOffset;
|
||||
tLog(timev || mOffset, lsTRACE) << "SNTP: Offset is " << timev << ", new system offset is " << mOffset;
|
||||
}
|
||||
|
||||
void SNTPClient::timerEntry(const boost::system::error_code& error)
|
||||
@@ -198,7 +196,7 @@ void SNTPClient::init(const std::vector<std::string>& servers)
|
||||
std::vector<std::string>::const_iterator it = servers.begin();
|
||||
if (it == servers.end())
|
||||
{
|
||||
Log(lsINFO) << "SNTP: no server specified";
|
||||
cLog(lsINFO) << "SNTP: no server specified";
|
||||
return;
|
||||
}
|
||||
BOOST_FOREACH(const std::string& it, servers)
|
||||
@@ -231,13 +229,13 @@ bool SNTPClient::doQuery()
|
||||
best = it;
|
||||
if (best == mServers.end())
|
||||
{
|
||||
Log(lsINFO) << "SNTP: No server to query";
|
||||
cLog(lsINFO) << "SNTP: No server to query";
|
||||
return false;
|
||||
}
|
||||
time_t now = time(NULL);
|
||||
if ((best->second != (time_t) -1) && ((best->second + NTP_MIN_QUERY) >= now))
|
||||
{
|
||||
Log(lsTRACE) << "SNTP: All servers recently queried";
|
||||
cLog(lsTRACE) << "SNTP: All servers recently queried";
|
||||
return false;
|
||||
}
|
||||
best->second = now;
|
||||
@@ -247,7 +245,7 @@ bool SNTPClient::doQuery()
|
||||
boost::bind(&SNTPClient::resolveComplete, this,
|
||||
boost::asio::placeholders::error, boost::asio::placeholders::iterator));
|
||||
#ifdef SNTP_DEBUG
|
||||
Log(lsTRACE) << "SNTP: Resolve pending for " << best->first;
|
||||
cLog(lsTRACE) << "SNTP: Resolve pending for " << best->first;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "Log.h"
|
||||
|
||||
DECLARE_INSTANCE(SerializedLedgerEntry)
|
||||
SETUP_LOG();
|
||||
|
||||
SerializedLedgerEntry::SerializedLedgerEntry(SerializerIterator& sit, const uint256& index)
|
||||
: STObject(sfLedgerEntry), mIndex(index)
|
||||
@@ -33,8 +34,8 @@ SerializedLedgerEntry::SerializedLedgerEntry(const Serializer& s, const uint256&
|
||||
mType = mFormat->t_type;
|
||||
if (!setType(mFormat->elements))
|
||||
{
|
||||
Log(lsWARNING) << "Ledger entry not valid for type " << mFormat->t_name;
|
||||
Log(lsWARNING) << getJson(0);
|
||||
cLog(lsWARNING) << "Ledger entry not valid for type " << mFormat->t_name;
|
||||
cLog(lsWARNING) << getJson(0);
|
||||
throw std::runtime_error("ledger entry not valid for type");
|
||||
}
|
||||
}
|
||||
@@ -99,7 +100,7 @@ uint32 SerializedLedgerEntry::getThreadedLedger()
|
||||
bool SerializedLedgerEntry::thread(const uint256& txID, uint32 ledgerSeq, uint256& prevTxID, uint32& prevLedgerID)
|
||||
{
|
||||
uint256 oldPrevTxID = getFieldH256(sfPreviousTxnID);
|
||||
Log(lsTRACE) << "Thread Tx:" << txID << " prev:" << oldPrevTxID;
|
||||
cLog(lsTRACE) << "Thread Tx:" << txID << " prev:" << oldPrevTxID;
|
||||
if (oldPrevTxID == txID)
|
||||
{ // this transaction is already threaded
|
||||
assert(getFieldU32(sfPreviousTxnLgrSeq) == ledgerSeq);
|
||||
|
||||
@@ -78,7 +78,7 @@ void WSDoor::startListening()
|
||||
}
|
||||
catch (websocketpp::exception& e)
|
||||
{
|
||||
Log(lsWARNING) << "websocketpp exception: " << e.what();
|
||||
cLog(lsWARNING) << "websocketpp exception: " << e.what();
|
||||
while (1) // temporary workaround for websocketpp throwing exceptions on access/close races
|
||||
{ // https://github.com/zaphoyd/websocketpp/issues/98
|
||||
try
|
||||
@@ -88,7 +88,7 @@ void WSDoor::startListening()
|
||||
}
|
||||
catch (websocketpp::exception& e)
|
||||
{
|
||||
Log(lsWARNING) << "websocketpp exception: " << e.what();
|
||||
cLog(lsWARNING) << "websocketpp exception: " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ void WSDoor::startListening()
|
||||
}
|
||||
catch (websocketpp::exception& e)
|
||||
{
|
||||
Log(lsWARNING) << "websocketpp exception: " << e.what();
|
||||
cLog(lsWARNING) << "websocketpp exception: " << e.what();
|
||||
while (1) // temporary workaround for websocketpp throwing exceptions on access/close races
|
||||
{ // https://github.com/zaphoyd/websocketpp/issues/98
|
||||
try
|
||||
@@ -124,7 +124,7 @@ void WSDoor::startListening()
|
||||
}
|
||||
catch (websocketpp::exception& e)
|
||||
{
|
||||
Log(lsWARNING) << "websocketpp exception: " << e.what();
|
||||
cLog(lsWARNING) << "websocketpp exception: " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user