diff --git a/src/ripple/basics/Log.h b/src/ripple/basics/Log.h index 19dc13ddaf..ea827e9d00 100644 --- a/src/ripple/basics/Log.h +++ b/src/ripple/basics/Log.h @@ -263,7 +263,7 @@ setDebugLogSink( may never be seen. Never use it for critical information. */ -beast::Journal::Stream +beast::Journal debugLog(); } // ripple diff --git a/src/ripple/basics/impl/Log.cpp b/src/ripple/basics/impl/Log.cpp index 44c74eb980..0deef8a0ab 100644 --- a/src/ripple/basics/impl/Log.cpp +++ b/src/ripple/basics/impl/Log.cpp @@ -403,10 +403,10 @@ setDebugLogSink( return debugSink().set(std::move(sink)); } -beast::Journal::Stream +beast::Journal debugLog() { - return { debugSink().get() }; + return beast::Journal (debugSink().get()); } } // ripple diff --git a/src/ripple/basics/impl/contract.cpp b/src/ripple/basics/impl/contract.cpp index 20c1aaba39..4cb64b8beb 100644 --- a/src/ripple/basics/impl/contract.cpp +++ b/src/ripple/basics/impl/contract.cpp @@ -43,14 +43,14 @@ accessViolation() noexcept void LogThrow (std::string const& title) { - JLOG(debugLog()) << title; + JLOG(debugLog().warn()) << title; } [[noreturn]] void LogicError (std::string const& s) noexcept { - JLOG(debugLog()) << s; + JLOG(debugLog().fatal()) << s; std::cerr << "Logic error: " << s << std::endl; detail::accessViolation(); } diff --git a/src/ripple/core/ReportUncaughtException.h b/src/ripple/core/ReportUncaughtException.h index 1ffdc1fe39..03996713d5 100644 --- a/src/ripple/core/ReportUncaughtException.h +++ b/src/ripple/core/ReportUncaughtException.h @@ -115,7 +115,7 @@ void reportUncaughtException ( if (! extra.empty()) ss << "; " << extra; - JLOG(debugLog()) << ss.str(); + JLOG(debugLog().fatal()) << ss.str(); std::cerr << ss.str() << std::endl; throw; }; diff --git a/src/ripple/core/SociDB.h b/src/ripple/core/SociDB.h index b6871af2f8..19d014d1d0 100644 --- a/src/ripple/core/SociDB.h +++ b/src/ripple/core/SociDB.h @@ -52,7 +52,7 @@ T rangeCheckedCast (C c) std::numeric_limits::is_signed && c < std::numeric_limits::lowest ())) { - JLOG (debugLog()) << "rangeCheckedCast domain error:" + JLOG (debugLog().error()) << "rangeCheckedCast domain error:" << " value = " << c << " min = " << std::numeric_limits::lowest () << " max: " << std::numeric_limits::max (); diff --git a/src/ripple/protocol/impl/STAmount.cpp b/src/ripple/protocol/impl/STAmount.cpp index 1170416f6e..f7288ecef3 100644 --- a/src/ripple/protocol/impl/STAmount.cpp +++ b/src/ripple/protocol/impl/STAmount.cpp @@ -906,7 +906,7 @@ amountFromJsonNoThrow (STAmount& result, Json::Value const& jvSource) } catch (const std::exception& e) { - JLOG (debugLog()) << + JLOG (debugLog().warn()) << "amountFromJsonNoThrow: caught: " << e.what (); } return false; diff --git a/src/ripple/protocol/impl/STArray.cpp b/src/ripple/protocol/impl/STArray.cpp index 09e6a53425..c58acc5054 100644 --- a/src/ripple/protocol/impl/STArray.cpp +++ b/src/ripple/protocol/impl/STArray.cpp @@ -76,7 +76,7 @@ STArray::STArray (SerialIter& sit, SField const& f) if ((type == STI_OBJECT) && (field == 1)) { - JLOG (debugLog()) << + JLOG (debugLog().error()) << "Encountered array with end of object marker"; Throw ("Illegal terminator in array"); } @@ -85,14 +85,14 @@ STArray::STArray (SerialIter& sit, SField const& f) if (fn.isInvalid ()) { - JLOG (debugLog()) << + JLOG (debugLog().error()) << "Unknown field: " << type << "/" << field; Throw ("Unknown field"); } if (fn.fieldType != STI_OBJECT) { - JLOG (debugLog()) << + JLOG (debugLog().error()) << "Array contains non-object"; Throw ("Non-object in array"); } diff --git a/src/ripple/protocol/impl/STInteger.cpp b/src/ripple/protocol/impl/STInteger.cpp index 122e074149..c6a05a2f39 100644 --- a/src/ripple/protocol/impl/STInteger.cpp +++ b/src/ripple/protocol/impl/STInteger.cpp @@ -52,7 +52,7 @@ STUInt8::getText () const if (transResultInfo (static_cast (value_), token, human)) return human; - JLOG (debugLog()) + JLOG (debugLog().error()) << "Unknown result code in metadata: " << value_; } @@ -70,7 +70,7 @@ STUInt8::getJson (int) const if (transResultInfo (static_cast (value_), token, human)) return token; - JLOG (debugLog()) + JLOG (debugLog().error()) << "Unknown result code in metadata: " << value_; } diff --git a/src/ripple/protocol/impl/STLedgerEntry.cpp b/src/ripple/protocol/impl/STLedgerEntry.cpp index a1fe627f87..9283225615 100644 --- a/src/ripple/protocol/impl/STLedgerEntry.cpp +++ b/src/ripple/protocol/impl/STLedgerEntry.cpp @@ -78,7 +78,7 @@ void STLedgerEntry::setSLEType () type_ = mFormat->getType (); if (!setType (mFormat->elements)) { - if (auto j = debugLog()) + if (auto j = debugLog().error()) { 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 (debugLog()) + JLOG (debugLog().info()) << "Thread Tx:" << txID << " prev:" << oldPrevTxID; if (oldPrevTxID == txID) diff --git a/src/ripple/protocol/impl/STObject.cpp b/src/ripple/protocol/impl/STObject.cpp index 7a6282174c..482acfb98e 100644 --- a/src/ripple/protocol/impl/STObject.cpp +++ b/src/ripple/protocol/impl/STObject.cpp @@ -113,7 +113,7 @@ bool STObject::setType (const SOTemplate& type) { if ((e->flags == SOE_DEFAULT) && iter->get().isDefault()) { - JLOG (debugLog()) + JLOG (debugLog().error()) << "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 (debugLog()) + JLOG (debugLog().error()) << "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 (debugLog()) + JLOG (debugLog().error()) << "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 (debugLog()) + JLOG (debugLog().error()) << "Encountered object with end of array marker"; Throw ("Illegal terminator in object"); } @@ -221,7 +221,7 @@ bool STObject::set (SerialIter& sit, int depth) if (fn.isInvalid ()) { - JLOG (debugLog()) + JLOG (debugLog().error()) << "Unknown field: field_type=" << type << ", field_name=" << field; Throw ("Unknown field"); diff --git a/src/ripple/protocol/impl/STPathSet.cpp b/src/ripple/protocol/impl/STPathSet.cpp index 99e5962e39..c782c7c1b9 100644 --- a/src/ripple/protocol/impl/STPathSet.cpp +++ b/src/ripple/protocol/impl/STPathSet.cpp @@ -64,7 +64,7 @@ STPathSet::STPathSet (SerialIter& sit, SField const& name) { if (path.empty ()) { - JLOG (debugLog()) + JLOG (debugLog().error()) << "Empty path in pathset"; Throw ("empty path"); } @@ -77,7 +77,7 @@ STPathSet::STPathSet (SerialIter& sit, SField const& name) } else if (iType & ~STPathElement::typeAll) { - JLOG (debugLog()) + JLOG (debugLog().error()) << "Bad path element " << iType << " in pathset"; Throw ("bad path element"); } diff --git a/src/ripple/protocol/impl/STValidation.cpp b/src/ripple/protocol/impl/STValidation.cpp index 946792d6f2..639dd19b5e 100644 --- a/src/ripple/protocol/impl/STValidation.cpp +++ b/src/ripple/protocol/impl/STValidation.cpp @@ -35,7 +35,7 @@ STValidation::STValidation (SerialIter& sit, bool checkSignature) if (checkSignature && !isValid ()) { - JLOG (debugLog()) + JLOG (debugLog().error()) << "Invalid validation" << getJson (0); Throw ("Invalid validation"); } @@ -113,7 +113,7 @@ bool STValidation::isValid (uint256 const& signingHash) const } catch (std::exception const&) { - JLOG (debugLog()) + JLOG (debugLog().error()) << "Exception validating validation"; return false; }