本文整理汇总了C++中beast::Journal::trace方法的典型用法代码示例。如果您正苦于以下问题:C++ Journal::trace方法的具体用法?C++ Journal::trace怎么用?C++ Journal::trace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类beast::Journal
的用法示例。
在下文中一共展示了Journal::trace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: JLOG
std::pair<std::vector<SignerEntries::SignerEntry>, TER>
SignerEntries::deserialize (
STObject const& obj, beast::Journal journal, std::string const& annotation)
{
std::pair<std::vector<SignerEntry>, TER> s;
if (!obj.isFieldPresent (sfSignerEntries))
{
JLOG(journal.trace()) <<
"Malformed " << annotation << ": Need signer entry array.";
s.second = temMALFORMED;
return s;
}
auto& accountVec = s.first;
accountVec.reserve (STTx::maxMultiSigners);
STArray const& sEntries (obj.getFieldArray (sfSignerEntries));
for (STObject const& sEntry : sEntries)
{
// Validate the SignerEntry.
if (sEntry.getFName () != sfSignerEntry)
{
JLOG(journal.trace()) <<
"Malformed " << annotation << ": Expected SignerEntry.";
s.second = temMALFORMED;
return s;
}
// Extract SignerEntry fields.
AccountID const account = sEntry.getAccountID (sfAccount);
std::uint16_t const weight = sEntry.getFieldU16 (sfSignerWeight);
accountVec.emplace_back (account, weight);
}
s.second = tesSUCCESS;
return s;
}
示例2: gotLedgerData
/** We received a TMLedgerData from a peer.
*/
bool gotLedgerData (LedgerHash const& hash,
std::shared_ptr<Peer> peer,
std::shared_ptr<protocol::TMLedgerData> packet_ptr) override
{
protocol::TMLedgerData& packet = *packet_ptr;
JLOG (j_.trace())
<< "Got data (" << packet.nodes ().size ()
<< ") for acquiring ledger: " << hash;
auto ledger = find (hash);
if (!ledger)
{
JLOG (j_.trace())
<< "Got data for ledger we're no longer acquiring";
// If it's state node data, stash it because it still might be
// useful.
if (packet.type () == protocol::liAS_NODE)
{
app_.getJobQueue().addJob(
jtLEDGER_DATA, "gotStaleData",
[this, packet_ptr] (Job&) { gotStaleData(packet_ptr); });
}
return false;
}
// Stash the data for later processing and see if we need to dispatch
if (ledger->gotData(std::weak_ptr<Peer>(peer), packet_ptr))
app_.getJobQueue().addJob (
jtLEDGER_DATA, "processLedgerData",
[this, hash] (Job&) { doLedgerData(hash); });
return true;
}
示例3: HTTPReply
void HTTPReply (
int nStatus, std::string const& content, Json::Output const& output, beast::Journal j)
{
JLOG (j.trace())
<< "HTTP Reply " << nStatus << " " << content;
if (nStatus == 401)
{
output ("HTTP/1.0 401 Authorization Required\r\n");
output (getHTTPHeaderTimestamp ());
// CHECKME this returns a different version than the replies below. Is
// this by design or an accident or should it be using
// BuildInfo::getFullVersionString () as well?
output ("Server: " + systemName () + "-json-rpc/v1");
output ("\r\n");
// Be careful in modifying this! If you change the contents you MUST
// update the Content-Length header as well to indicate the correct
// size of the data.
output ("WWW-Authenticate: Basic realm=\"jsonrpc\"\r\n"
"Content-Type: text/html\r\n"
"Content-Length: 296\r\n"
"\r\n"
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 "
"Transitional//EN\"\r\n"
"\"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"
"\">\r\n"
"<HTML>\r\n"
"<HEAD>\r\n"
"<TITLE>Error</TITLE>\r\n"
"<META HTTP-EQUIV='Content-Type' "
"CONTENT='text/html; charset=ISO-8859-1'>\r\n"
"</HEAD>\r\n"
"<BODY><H1>401 Unauthorized.</H1></BODY>\r\n");
return;
}
switch (nStatus)
{
case 200: output ("HTTP/1.1 200 OK\r\n"); break;
case 400: output ("HTTP/1.1 400 Bad Request\r\n"); break;
case 403: output ("HTTP/1.1 403 Forbidden\r\n"); break;
case 404: output ("HTTP/1.1 404 Not Found\r\n"); break;
case 500: output ("HTTP/1.1 500 Internal Server Error\r\n"); break;
case 503: output ("HTTP/1.1 503 Server is overloaded\r\n"); break;
}
output (getHTTPHeaderTimestamp ());
output ("Connection: Keep-Alive\r\n"
"Content-Length: ");
// VFALCO TODO Determine if/when this header should be added
//if (context.app.config().RPC_ALLOW_REMOTE)
// output ("Access-Control-Allow-Origin: *\r\n");
output (std::to_string(content.size () + 2));
output ("\r\n"
"Content-Type: application/json; charset=UTF-8\r\n");
output ("Server: " + systemName () + "-json-rpc/");
output (BuildInfo::getFullVersionString ());
output ("\r\n"
"\r\n");
output (content);
output ("\r\n");
}
示例4: Issue
path::RippleCalc::Output
flow (
PaymentSandbox& sb,
STAmount const& deliver,
AccountID const& src,
AccountID const& dst,
STPathSet const& paths,
bool defaultPaths,
bool partialPayment,
bool ownerPaysTransferFee,
boost::optional<Quality> const& limitQuality,
boost::optional<STAmount> const& sendMax,
beast::Journal j,
path::detail::FlowDebugInfo* flowDebugInfo)
{
Issue const srcIssue = [&] {
if (sendMax)
return sendMax->issue ();
if (!isXRP (deliver.issue ().currency))
return Issue (deliver.issue ().currency, src);
return xrpIssue ();
}();
Issue const dstIssue = deliver.issue ();
boost::optional<Issue> sendMaxIssue;
if (sendMax)
sendMaxIssue = sendMax->issue ();
// convert the paths to a collection of strands. Each strand is the collection
// of account->account steps and book steps that may be used in this payment.
auto sr = toStrands (sb, src, dst, dstIssue, sendMaxIssue, paths,
defaultPaths, ownerPaysTransferFee, j);
if (sr.first != tesSUCCESS)
{
path::RippleCalc::Output result;
result.setResult (sr.first);
return result;
}
auto& strands = sr.second;
if (j.trace())
{
j.trace() << "\nsrc: " << src << "\ndst: " << dst
<< "\nsrcIssue: " << srcIssue << "\ndstIssue: " << dstIssue;
j.trace() << "\nNumStrands: " << strands.size ();
for (auto const& curStrand : strands)
{
j.trace() << "NumSteps: " << curStrand.size ();
for (auto const& step : curStrand)
{
j.trace() << '\n' << *step << '\n';
}
}
}
const bool srcIsXRP = isXRP (srcIssue.currency);
const bool dstIsXRP = isXRP (dstIssue.currency);
auto const asDeliver = toAmountSpec (deliver);
// The src account may send either xrp or iou. The dst account may receive
// either xrp or iou. Since XRP and IOU amounts are represented by different
// types, use templates to tell `flow` about the amount types.
if (srcIsXRP && dstIsXRP)
{
return finishFlow (sb, srcIssue, dstIssue,
flow<XRPAmount, XRPAmount> (
sb, strands, asDeliver.xrp, defaultPaths, partialPayment,
limitQuality, sendMax, j, flowDebugInfo));
}
if (srcIsXRP && !dstIsXRP)
{
return finishFlow (sb, srcIssue, dstIssue,
flow<XRPAmount, IOUAmount> (
sb, strands, asDeliver.iou, defaultPaths, partialPayment,
limitQuality, sendMax, j, flowDebugInfo));
}
if (!srcIsXRP && dstIsXRP)
{
return finishFlow (sb, srcIssue, dstIssue,
flow<IOUAmount, XRPAmount> (
sb, strands, asDeliver.xrp, defaultPaths, partialPayment,
limitQuality, sendMax, j, flowDebugInfo));
}
assert (!srcIsXRP && !dstIsXRP);
return finishFlow (sb, srcIssue, dstIssue,
flow<IOUAmount, IOUAmount> (
sb, strands, asDeliver.iou, defaultPaths, partialPayment,
limitQuality, sendMax, j, flowDebugInfo));
}