Access Journal::Stream using member functions (RIPD-1087):

Replace Journal public data members with member function accessors
in order to make Journal lighter weight.  The change makes a
Journal cheaper to pass by value.

Also add missing stream checks (e.g., calls to JLOG) to avoid
text processing that ultimately will not be stored in the log.
This commit is contained in:
Scott Schurr
2016-03-09 10:48:21 -08:00
committed by seelabs
parent b3f5986c83
commit 7a4bd2278d
132 changed files with 1843 additions and 1799 deletions

View File

@@ -915,7 +915,7 @@ amountFromJsonNoThrow (STAmount& result, Json::Value const& jvSource)
}
catch (const std::exception& e)
{
JLOG (debugJournal().debug) <<
JLOG (debugJournal().debug()) <<
"amountFromJsonNoThrow: caught: " << e.what ();
}
return false;

View File

@@ -76,7 +76,7 @@ STArray::STArray (SerialIter& sit, SField const& f)
if ((type == STI_OBJECT) && (field == 1))
{
JLOG (debugJournal().warning) <<
JLOG (debugJournal().warn()) <<
"Encountered array with end of object marker";
Throw<std::runtime_error> ("Illegal terminator in array");
}
@@ -85,14 +85,14 @@ STArray::STArray (SerialIter& sit, SField const& f)
if (fn.isInvalid ())
{
JLOG (debugJournal().trace) <<
JLOG (debugJournal().trace()) <<
"Unknown field: " << type << "/" << field;
Throw<std::runtime_error> ("Unknown field");
}
if (fn.fieldType != STI_OBJECT)
{
JLOG (debugJournal().trace) <<
JLOG (debugJournal().trace()) <<
"Array contains non-object";
Throw<std::runtime_error> ("Non-object in array");
}

View File

@@ -52,7 +52,7 @@ STUInt8::getText () const
if (transResultInfo (static_cast<TER> (value_), token, human))
return human;
JLOG (debugJournal().warning)
JLOG (debugJournal().warn())
<< "Unknown result code in metadata: " << value_;
}
@@ -70,7 +70,7 @@ STUInt8::getJson (int) const
if (transResultInfo (static_cast<TER> (value_), token, human))
return token;
JLOG (debugJournal().warning)
JLOG (debugJournal().warn())
<< "Unknown result code in metadata: " << value_;
}

View File

@@ -78,7 +78,7 @@ void STLedgerEntry::setSLEType ()
type_ = mFormat->getType ();
if (!setType (mFormat->elements))
{
if (auto j = debugJournal().warning)
if (auto j = debugJournal().warn())
{
j << "Ledger entry not valid for type " << mFormat->getName ();
j << "Object: " << getJson (0);
@@ -141,7 +141,7 @@ bool STLedgerEntry::thread (uint256 const& txID, std::uint32_t ledgerSeq,
{
uint256 oldPrevTxID = getFieldH256 (sfPreviousTxnID);
JLOG (debugJournal().trace)
JLOG (debugJournal().trace())
<< "Thread Tx:" << txID << " prev:" << oldPrevTxID;
if (oldPrevTxID == txID)

View File

@@ -113,7 +113,7 @@ bool STObject::setType (const SOTemplate& type)
{
if ((e->flags == SOE_DEFAULT) && iter->get().isDefault())
{
JLOG (debugJournal().warning)
JLOG (debugJournal().warn())
<< "setType(" << getFName().getName()
<< "): explicit default " << e->e_field.fieldName;
valid = false;
@@ -125,7 +125,7 @@ bool STObject::setType (const SOTemplate& type)
{
if (e->flags == SOE_REQUIRED)
{
JLOG (debugJournal().warning)
JLOG (debugJournal().warn())
<< "setType(" << getFName().getName()
<< "): missing " << e->e_field.fieldName;
valid = false;
@@ -138,7 +138,7 @@ bool STObject::setType (const SOTemplate& type)
// Anything left over in the object must be discardable
if (! e->getFName().isDiscardable())
{
JLOG (debugJournal().warning)
JLOG (debugJournal().warn())
<< "setType(" << getFName().getName()
<< "): non-discardable leftover " << e->getFName().getName ();
valid = false;
@@ -208,7 +208,7 @@ bool STObject::set (SerialIter& sit, int depth)
if ((type == STI_ARRAY) && (field == 1))
{
JLOG (debugJournal().warning)
JLOG (debugJournal().warn())
<< "Encountered object with end of array marker";
Throw<std::runtime_error> ("Illegal terminator in object");
}
@@ -221,7 +221,7 @@ bool STObject::set (SerialIter& sit, int depth)
if (fn.isInvalid ())
{
JLOG (debugJournal().warning)
JLOG (debugJournal().warn())
<< "Unknown field: field_type=" << type
<< ", field_name=" << field;
Throw<std::runtime_error> ("Unknown field");

View File

@@ -64,7 +64,7 @@ STPathSet::STPathSet (SerialIter& sit, SField const& name)
{
if (path.empty ())
{
JLOG (debugJournal().info)
JLOG (debugJournal().info())
<< "Empty path in pathset";
Throw<std::runtime_error> ("empty path");
}
@@ -77,7 +77,7 @@ STPathSet::STPathSet (SerialIter& sit, SField const& name)
}
else if (iType & ~STPathElement::typeAll)
{
JLOG (debugJournal().info)
JLOG (debugJournal().info())
<< "Bad path element " << iType << " in pathset";
Throw<std::runtime_error> ("bad path element");
}

View File

@@ -35,7 +35,7 @@ STValidation::STValidation (SerialIter& sit, bool checkSignature)
if (checkSignature && !isValid ())
{
JLOG (debugJournal().trace)
JLOG (debugJournal().trace())
<< "Invalid validation" << getJson (0);
Throw<std::runtime_error> ("Invalid validation");
}
@@ -113,7 +113,7 @@ bool STValidation::isValid (uint256 const& signingHash) const
}
catch (std::exception const&)
{
JLOG (debugJournal().info)
JLOG (debugJournal().info())
<< "Exception validating validation";
return false;
}