本文整理汇总了C++中JLOG函数的典型用法代码示例。如果您正苦于以下问题:C++ JLOG函数的具体用法?C++ JLOG怎么用?C++ JLOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了JLOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: terminateHandler
void terminateHandler()
{
if (std::current_exception())
{
std::string const name = threadName.get() ? *threadName.get() : "Unknown";
try
{
throw;
}
catch (const std::exception& e)
{
std::cerr << name << ": " << e.what () << '\n';
JLOG(debugLog().fatal())
<< name << ": " << e.what () << '\n';
}
catch (boost::coroutines::detail::forced_unwind const&)
{
std::cerr << name << ": forced_unwind\n";
JLOG(debugLog().fatal())
<< name << ": forced_unwind\n";
}
catch (...)
{
std::cerr << name << ": unknown exception\n";
JLOG (debugLog ().fatal ())
<< name << ": unknown exception\n";
}
}
}
示例2: doCommand
Status doCommand (
RPC::Context& context, Json::Value& result)
{
Handler const * handler = nullptr;
if (auto error = fillHandler (context, handler))
{
inject_error (error, result);
return error;
}
if (auto method = handler->valueMethod_)
{
if (! context.headers.user.empty() ||
! context.headers.forwardedFor.empty())
{
JLOG(context.j.debug()) << "start command: " << handler->name_ <<
", X-User: " << context.headers.user << ", X-Forwarded-For: " <<
context.headers.forwardedFor;
auto ret = callMethod (context, method, handler->name_, result);
JLOG(context.j.debug()) << "finish command: " << handler->name_ <<
", X-User: " << context.headers.user << ", X-Forwarded-For: " <<
context.headers.forwardedFor;
return ret;
}
else
{
return callMethod (context, method, handler->name_, result);
}
}
return rpcUNKNOWN_COMMAND;
}
示例3: count
// Checks the cache size and prunes if its over the limit.
void
Bootcache::prune ()
{
if (size() <= Tuning::bootcacheSize)
return;
// Calculate the amount to remove
auto count ((size() *
Tuning::bootcachePrunePercent) / 100);
decltype(count) pruned (0);
// Work backwards because bimap doesn't handle
// erasing using a reverse iterator very well.
//
for (auto iter (m_map.right.end());
count-- > 0 && iter != m_map.right.begin(); ++pruned)
{
--iter;
beast::IP::Endpoint const& endpoint (iter->get_left());
Entry const& entry (iter->get_right());
JLOG(m_journal.trace()) << beast::leftw (18) <<
"Bootcache pruned" << endpoint <<
" at valence " << entry.valence();
iter = m_map.right.erase (iter);
}
JLOG(m_journal.debug()) << beast::leftw (18) <<
"Bootcache pruned " << pruned << " entries total";
}
示例4: preflight1
/** Performs early sanity checks on the account and fee fields */
NotTEC
preflight1 (PreflightContext const& ctx)
{
auto const ret = preflight0(ctx);
if (!isTesSuccess(ret))
return ret;
auto const id = ctx.tx.getAccountID(sfAccount);
if (id == beast::zero)
{
JLOG(ctx.j.warn()) << "preflight1: bad account id";
return temBAD_SRC_ACCOUNT;
}
// No point in going any further if the transaction fee is malformed.
auto const fee = ctx.tx.getFieldAmount (sfFee);
if (!fee.native () || fee.negative () || !isLegalAmount (fee.xrp ()))
{
JLOG(ctx.j.debug()) << "preflight1: invalid fee";
return temBAD_FEE;
}
auto const spk = ctx.tx.getSigningPubKey();
if (!spk.empty () && !publicKeyType (makeSlice (spk)))
{
JLOG(ctx.j.debug()) << "preflight1: invalid signing key";
return temBAD_SIGNATURE;
}
return tesSUCCESS;
}
示例5: preflight1
TER
CancelOffer::preflight (PreflightContext const& ctx)
{
auto const ret = preflight1 (ctx);
if (!isTesSuccess (ret))
return ret;
auto const uTxFlags = ctx.tx.getFlags();
if (uTxFlags & tfUniversalMask)
{
JLOG(ctx.j.trace) << "Malformed transaction: " <<
"Invalid flags set.";
return temINVALID_FLAG;
}
auto const seq = ctx.tx.getFieldU32 (sfOfferSequence);
if (! seq)
{
JLOG(ctx.j.trace) <<
"CancelOffer::preflight: missing sequence";
return temBAD_SEQUENCE;
}
return preflight2(ctx);
}
示例6: sociRawData
void
ManifestCache::load (
DatabaseCon& dbCon, std::string const& dbTable)
{
// Load manifests stored in database
std::string const sql =
"SELECT RawData FROM " + dbTable + ";";
auto db = dbCon.checkoutDb ();
soci::blob sociRawData (*db);
soci::statement st =
(db->prepare << sql,
soci::into (sociRawData));
st.execute ();
while (st.fetch ())
{
std::string serialized;
convert (sociRawData, serialized);
if (auto mo = Manifest::make_Manifest (std::move (serialized)))
{
if (!mo->verify())
{
JLOG(j_.warn())
<< "Unverifiable manifest in db";
continue;
}
applyManifest (std::move(*mo));
}
else
{
JLOG(j_.warn())
<< "Malformed manifest in database";
}
}
}
示例7: clear
void
Bootcache::load ()
{
clear();
auto const n (m_store.load (
[this](beast::IP::Endpoint const& endpoint, int valence)
{
auto const result (this->m_map.insert (
value_type (endpoint, valence)));
if (! result.second)
{
JLOG(this->m_journal.error())
<< beast::leftw (18) <<
"Bootcache discard " << endpoint;
}
}));
if (n > 0)
{
JLOG(m_journal.info()) << beast::leftw (18) <<
"Bootcache loaded " << n <<
((n > 1) ? " addresses" : " address");
prune ();
}
}
示例8: doApply
std::pair<TER, bool>
doApply(PreclaimResult const& preclaimResult,
Application& app, OpenView& view)
{
if (preclaimResult.view.seq() != view.seq())
{
// Logic error from the caller. Don't have enough
// info to recover.
return{ tefEXCEPTION, false };
}
try
{
if (!preclaimResult.likelyToClaimFee)
return{ preclaimResult.ter, false };
ApplyContext ctx(app, view,
preclaimResult.tx, preclaimResult.ter,
preclaimResult.baseFee, preclaimResult.flags,
preclaimResult.j);
if (view.txExists (ctx.tx.getTransactionID ()))
{
JLOG (preclaimResult.j.warning) << "transaction duplicates!";
return {tefALREADY, false};
}
return invoke_apply(ctx);
}
catch (std::exception const& e)
{
JLOG(preclaimResult.j.fatal) <<
"apply: " << e.what();
return { tefEXCEPTION, false };
}
}
示例9: JLOG
TER PathCursor::liquidity () const
{
TER resultCode = tecPATH_DRY;
PathCursor pc = *this;
pathState_.resetView (rippleCalc_.view);
for (pc.nodeIndex_ = pc.nodeSize(); pc.nodeIndex_--; )
{
JLOG (j_.trace())
<< "reverseLiquidity>"
<< " nodeIndex=" << pc.nodeIndex_
<< ".issue_.account=" << to_string (pc.node().issue_.account);
resultCode = pc.reverseLiquidity();
if (!pc.node().transferRate_)
return tefINTERNAL;
JLOG (j_.trace())
<< "reverseLiquidity< "
<< "nodeIndex=" << pc.nodeIndex_
<< " resultCode=" << transToken (resultCode)
<< " transferRate_=" << *pc.node().transferRate_
<< ": " << resultCode;
if (resultCode != tesSUCCESS)
break;
}
// VFALCO-FIXME this generates errors
// JLOG (j_.trace())
// << "nextIncrement: Path after reverse: " << pathState_.getJson ();
if (resultCode != tesSUCCESS)
return resultCode;
pathState_.resetView (rippleCalc_.view);
for (pc.nodeIndex_ = 0; pc.nodeIndex_ < pc.nodeSize(); ++pc.nodeIndex_)
{
JLOG (j_.trace())
<< "forwardLiquidity> nodeIndex=" << nodeIndex_;
resultCode = pc.forwardLiquidity();
if (resultCode != tesSUCCESS)
return resultCode;
JLOG (j_.trace())
<< "forwardLiquidity<"
<< " nodeIndex:" << pc.nodeIndex_
<< " resultCode:" << resultCode;
if (pathState_.isDry())
resultCode = tecPATH_DRY;
}
return resultCode;
}
示例10: preflight1
TER
SetTrust::preflight (PreflightContext const& ctx)
{
auto const ret = preflight1 (ctx);
if (!isTesSuccess (ret))
return ret;
auto& tx = ctx.tx;
auto& j = ctx.j;
std::uint32_t const uTxFlags = tx.getFlags ();
if (uTxFlags & tfTrustSetMask)
{
JLOG(j.trace) <<
"Malformed transaction: Invalid flags set.";
return temINVALID_FLAG;
}
STAmount const saLimitAmount (tx.getFieldAmount (sfLimitAmount));
if (!isLegalNet (saLimitAmount))
return temBAD_AMOUNT;
if (saLimitAmount.native ())
{
JLOG(j.trace) <<
"Malformed transaction: specifies native limit " <<
saLimitAmount.getFullText ();
return temBAD_LIMIT;
}
if (badCurrency() == saLimitAmount.getCurrency ())
{
JLOG(j.trace) <<
"Malformed transaction: specifies XRP as IOU";
return temBAD_CURRENCY;
}
if (saLimitAmount < zero)
{
JLOG(j.trace) <<
"Malformed transaction: Negative credit limit.";
return temBAD_LIMIT;
}
// Check if destination makes sense.
auto const& issuer = saLimitAmount.getIssuer ();
if (!issuer || issuer == noAccount())
{
JLOG(j.trace) <<
"Malformed transaction: no destination account.";
return temDST_NEEDED;
}
return preflight2 (ctx);
}
示例11: load
bool
ManifestCache::load (
DatabaseCon& dbCon, std::string const& dbTable,
std::string const& configManifest,
std::vector<std::string> const& configRevocation)
{
load (dbCon, dbTable);
if (! configManifest.empty())
{
auto mo = Manifest::make_Manifest (
beast::detail::base64_decode(configManifest));
if (! mo)
{
JLOG (j_.error()) << "Malformed validator_token in config";
return false;
}
if (mo->revoked())
{
JLOG (j_.warn()) <<
"Configured manifest revokes public key";
}
if (applyManifest (std::move(*mo)) ==
ManifestDisposition::invalid)
{
JLOG (j_.error()) << "Manifest in config was rejected";
return false;
}
}
if (! configRevocation.empty())
{
std::string revocationStr;
revocationStr.reserve (
std::accumulate (configRevocation.cbegin(), configRevocation.cend(), std::size_t(0),
[] (std::size_t init, std::string const& s)
{
return init + s.size();
}));
for (auto const& line : configRevocation)
revocationStr += beast::rfc2616::trim(line);
auto mo = Manifest::make_Manifest (
beast::detail::base64_decode(revocationStr));
if (! mo || ! mo->revoked() ||
applyManifest (std::move(*mo)) == ManifestDisposition::invalid)
{
JLOG (j_.error()) << "Invalid validator key revocation in config";
return false;
}
}
return true;
}
示例12: JLOG
TER
SetSignerList::validateQuorumAndSignerEntries (
std::uint32_t quorum,
std::vector<SignerEntries::SignerEntry> const& signers,
AccountID const& account,
beast::Journal j)
{
// Reject if there are too many or too few entries in the list.
{
std::size_t const signerCount = signers.size ();
if ((signerCount < STTx::minMultiSigners)
|| (signerCount > STTx::maxMultiSigners))
{
JLOG(j.trace) << "Too many or too few signers in signer list.";
return temMALFORMED;
}
}
// Make sure there are no duplicate signers.
assert(std::is_sorted(signers.begin(), signers.end()));
if (std::adjacent_find (
signers.begin (), signers.end ()) != signers.end ())
{
JLOG(j.trace) << "Duplicate signers in signer list";
return temBAD_SIGNER;
}
// Make sure no signers reference this account. Also make sure the
// quorum can be reached.
std::uint64_t allSignersWeight (0);
for (auto const& signer : signers)
{
std::uint32_t const weight = signer.weight;
if (weight <= 0)
{
JLOG(j.trace) << "Every signer must have a positive weight.";
return temBAD_WEIGHT;
}
allSignersWeight += signer.weight;
if (signer.account == account)
{
JLOG(j.trace) << "A signer may not self reference account.";
return temBAD_SIGNER;
}
// Don't verify that the signer accounts exist. Non-existent accounts
// may be phantom accounts (which are permitted).
}
if ((quorum <= 0) || (allSignersWeight < quorum))
{
JLOG(j.trace) << "Quorum is unreachable";
return temBAD_QUORUM;
}
return tesSUCCESS;
}
示例13: stop
void stop () override
{
stop_async ();
JLOG(m_journal.debug()) << "Waiting to stop";
std::unique_lock<std::mutex> lk{m_mut};
m_cv.wait(lk, [this]{return m_asyncHandlersCompleted;});
lk.unlock();
JLOG(m_journal.debug()) << "Stopped";
}
示例14: STBase
STPathSet::STPathSet (SerialIter& sit, SField const& name)
: STBase(name)
{
std::vector<STPathElement> path;
for(;;)
{
int iType = sit.get8 ();
if (iType == STPathElement::typeNone ||
iType == STPathElement::typeBoundary)
{
if (path.empty ())
{
JLOG (debugLog().error())
<< "Empty path in pathset";
Throw<std::runtime_error> ("empty path");
}
push_back (path);
path.clear ();
if (iType == STPathElement::typeNone)
return;
}
else if (iType & ~STPathElement::typeAll)
{
JLOG (debugLog().error())
<< "Bad path element " << iType << " in pathset";
Throw<std::runtime_error> ("bad path element");
}
else
{
auto hasAccount = iType & STPathElement::typeAccount;
auto hasCurrency = iType & STPathElement::typeCurrency;
auto hasIssuer = iType & STPathElement::typeIssuer;
AccountID account;
Currency currency;
AccountID issuer;
if (hasAccount)
account.copyFrom (sit.get160 ());
if (hasCurrency)
currency.copyFrom (sit.get160 ());
if (hasIssuer)
issuer.copyFrom (sit.get160 ());
path.emplace_back (account, currency, issuer, hasCurrency);
}
}
}
示例15: JLOG
bool JMP3::setLoop(bool loop) {
JLOG("Start JMP3::setLoop");
if (!init_done) {
JLOG("JMP3::setLoop called but init_done is false!");
return false;
}
#ifdef MP3_SUPPORT
sceMp3SetLoopNum(m_mp3Handle, (loop == true) ? -1 : 0);
#endif
return (m_loop = loop);
JLOG("End JMP3::setLoop");
}