mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 03:26:01 +00:00
Streamline Log with print() and out()
This commit is contained in:
@@ -1014,10 +1014,10 @@ void callRPC (
|
||||
// Connect to localhost
|
||||
if (!theConfig.QUIET)
|
||||
{
|
||||
std::cerr << "Connecting to: " << strIp << ":" << iPort << std::endl;
|
||||
// std::cerr << "Username: " << strUsername << ":" << strPassword << std::endl;
|
||||
// std::cerr << "Path: " << strPath << std::endl;
|
||||
// std::cerr << "Method: " << strMethod << std::endl;
|
||||
Log::out() << "Connecting to: " << strIp << ":" << iPort;
|
||||
// Log::out() << "Username: " << strUsername << ":" << strPassword;
|
||||
// Log::out() << "Path: " << strPath;
|
||||
// Log::out() << "Method: " << strMethod;
|
||||
}
|
||||
|
||||
// HTTP basic authentication
|
||||
|
||||
@@ -268,7 +268,7 @@ bool Ledger::hasAccount (const RippleAddress& accountID)
|
||||
AccountState::pointer Ledger::getAccountState (const RippleAddress& accountID)
|
||||
{
|
||||
#ifdef BEAST_DEBUG
|
||||
// std::cerr << "Ledger:getAccountState(" << accountID.humanAccountID() << ")" << std::endl;
|
||||
// Log::out() << "Ledger:getAccountState(" << accountID.humanAccountID() << ")";
|
||||
#endif
|
||||
|
||||
SLE::pointer sle = getSLEi (Ledger::getAccountRootIndex (accountID));
|
||||
|
||||
@@ -275,9 +275,9 @@ Json::Value RPCHandler::transactionSign (Json::Value params, bool bSubmit, bool
|
||||
// ... or the master key must have been used.
|
||||
&& raSrcAddressID.getAccountID () != naAccountPublic.getAccountID ())
|
||||
{
|
||||
// std::cerr << "iIndex: " << iIndex << std::endl;
|
||||
// std::cerr << "sfAuthorizedKey: " << strHex(asSrc->getAuthorizedKey().getAccountID()) << std::endl;
|
||||
// std::cerr << "naAccountPublic: " << strHex(naAccountPublic.getAccountID()) << std::endl;
|
||||
// Log::out() << "iIndex: " << iIndex;
|
||||
// Log::out() << "sfAuthorizedKey: " << strHex(asSrc->getAuthorizedKey().getAccountID());
|
||||
// Log::out() << "naAccountPublic: " << strHex(naAccountPublic.getAccountID());
|
||||
|
||||
return rpcError (rpcSRC_ACT_NOT_FOUND);
|
||||
}
|
||||
@@ -493,9 +493,9 @@ Json::Value RPCHandler::authorize (Ledger::ref lrLedger,
|
||||
|
||||
if (asSrc->haveAuthorizedKey () && (asSrc->getAuthorizedKey ().getAccountID () != naAccountPublic.getAccountID ()))
|
||||
{
|
||||
// std::cerr << "iIndex: " << iIndex << std::endl;
|
||||
// std::cerr << "sfAuthorizedKey: " << strHex(asSrc->getAuthorizedKey().getAccountID()) << std::endl;
|
||||
// std::cerr << "naAccountPublic: " << strHex(naAccountPublic.getAccountID()) << std::endl;
|
||||
// Log::out() << "iIndex: " << iIndex;
|
||||
// Log::out() << "sfAuthorizedKey: " << strHex(asSrc->getAuthorizedKey().getAccountID());
|
||||
// Log::out() << "naAccountPublic: " << strHex(naAccountPublic.getAccountID());
|
||||
|
||||
return rpcError (rpcPASSWD_CHANGED);
|
||||
}
|
||||
@@ -2113,7 +2113,7 @@ Json::Value RPCHandler::doValidationSeed (Json::Value params, LoadType* loadType
|
||||
|
||||
if (!params.isMember ("secret"))
|
||||
{
|
||||
std::cerr << "Unset validation seed." << std::endl;
|
||||
Log::out() << "Unset validation seed.";
|
||||
|
||||
theConfig.VALIDATION_SEED.clear ();
|
||||
theConfig.VALIDATION_PUB.clear ();
|
||||
|
||||
@@ -18,7 +18,7 @@ RPCServer::RPCServer (boost::asio::io_service& io_service, boost::asio::ssl::con
|
||||
|
||||
void RPCServer::connected ()
|
||||
{
|
||||
//std::cerr << "RPC request" << std::endl;
|
||||
//Log::out() << "RPC request";
|
||||
boost::asio::async_read_until (mSocket, mLineBuffer, "\r\n",
|
||||
mStrand.wrap (boost::bind (&RPCServer::handle_read_line, shared_from_this (), boost::asio::placeholders::error)));
|
||||
}
|
||||
@@ -178,7 +178,7 @@ bool RPCServer::parseAcceptRate (const std::string& sAcceptRate)
|
||||
|
||||
void RPCServer::handle_write (const boost::system::error_code& e)
|
||||
{
|
||||
//std::cerr << "async_write complete " << e << std::endl;
|
||||
//Log::out() << "async_write complete " << e;
|
||||
|
||||
if (!e)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ uint64 RegularKeySetTransactor::calculateBaseFee ()
|
||||
|
||||
TER RegularKeySetTransactor::doApply ()
|
||||
{
|
||||
std::cerr << "RegularKeySet>" << std::endl;
|
||||
Log::out() << "RegularKeySet>";
|
||||
|
||||
const uint32 uTxFlags = mTxn.getFlags ();
|
||||
|
||||
@@ -50,7 +50,7 @@ TER RegularKeySetTransactor::doApply ()
|
||||
mTxnAccount->makeFieldAbsent (sfRegularKey);
|
||||
}
|
||||
|
||||
std::cerr << "RegularKeySet<" << std::endl;
|
||||
Log::out() << "RegularKeySet<";
|
||||
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ SETUP_LOG (WalletAddTransactor)
|
||||
|
||||
TER WalletAddTransactor::doApply ()
|
||||
{
|
||||
std::cerr << "WalletAdd>" << std::endl;
|
||||
Log::out() << "WalletAdd>";
|
||||
|
||||
Blob const vucPubKey = mTxn.getFieldVL (sfPublicKey);
|
||||
Blob const vucSignature = mTxn.getFieldVL (sfSignature);
|
||||
@@ -28,7 +28,7 @@ TER WalletAddTransactor::doApply ()
|
||||
// FIXME: This should be moved to the transaction's signature check logic and cached
|
||||
if (!naMasterPubKey.accountPublicVerify (Serializer::getSHA512Half (uAuthKeyID.begin (), uAuthKeyID.size ()), vucSignature))
|
||||
{
|
||||
std::cerr << "WalletAdd: unauthorized: bad signature " << std::endl;
|
||||
Log::out() << "WalletAdd: unauthorized: bad signature ";
|
||||
|
||||
return tefBAD_ADD_AUTH;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ TER WalletAddTransactor::doApply ()
|
||||
|
||||
if (sleDst)
|
||||
{
|
||||
std::cerr << "WalletAdd: account already created" << std::endl;
|
||||
Log::out() << "WalletAdd: account already created";
|
||||
|
||||
return tefCREATED;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ TER WalletAddTransactor::doApply ()
|
||||
sleDst->setFieldAmount (sfBalance, saDstAmount);
|
||||
sleDst->setFieldAccount (sfRegularKey, uAuthKeyID);
|
||||
|
||||
std::cerr << "WalletAdd<" << std::endl;
|
||||
Log::out() << "WalletAdd<";
|
||||
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ void LocalCredentials::start ()
|
||||
}
|
||||
|
||||
if (!theConfig.QUIET)
|
||||
std::cerr << "NodeIdentity: " << mNodePublicKey.humanNodePublic () << std::endl;
|
||||
Log::out() << "NodeIdentity: " << mNodePublicKey.humanNodePublic ();
|
||||
|
||||
getApp().getUNL ().start ();
|
||||
}
|
||||
@@ -67,7 +67,7 @@ bool LocalCredentials::nodeIdentityLoad ()
|
||||
bool LocalCredentials::nodeIdentityCreate ()
|
||||
{
|
||||
if (!theConfig.QUIET)
|
||||
std::cerr << "NodeIdentity: Creating." << std::endl;
|
||||
Log::out() << "NodeIdentity: Creating.";
|
||||
|
||||
//
|
||||
// Generate the public and private key
|
||||
@@ -114,7 +114,7 @@ bool LocalCredentials::nodeIdentityCreate ()
|
||||
// XXX Check error result.
|
||||
|
||||
if (!theConfig.QUIET)
|
||||
std::cerr << "NodeIdentity: Created." << std::endl;
|
||||
Log::out() << "NodeIdentity: Created.";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ void startServer ()
|
||||
const Json::Value& jvCommand = theConfig.RPC_STARTUP[i];
|
||||
|
||||
if (!theConfig.QUIET)
|
||||
std::cerr << "Startup RPC: " << jvCommand << std::endl;
|
||||
Log::out() << "Startup RPC: " << jvCommand;
|
||||
|
||||
RPCHandler rhHandler (&getApp().getOPs ());
|
||||
|
||||
@@ -35,7 +35,7 @@ void startServer ()
|
||||
Json::Value jvResult = rhHandler.doCommand (jvCommand, RPCHandler::ADMIN, &loadType);
|
||||
|
||||
if (!theConfig.QUIET)
|
||||
std::cerr << "Result: " << jvResult << std::endl;
|
||||
Log::out() << "Result: " << jvResult;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ int rippleMain (int argc, char** argv)
|
||||
|
||||
if (! RandomNumbers::getInstance ().initialize ())
|
||||
{
|
||||
std::cerr << "Unable to add system entropy" << std::endl;
|
||||
Log::out() << "Unable to add system entropy";
|
||||
iResult = 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
// VFALCO TODO make this an inline function
|
||||
#define ADDRESS(p) strHex(uint64( ((char*) p) - ((char*) 0)))
|
||||
|
||||
SETUP_LOG (Peer)
|
||||
|
||||
class PeerImp;
|
||||
@@ -207,7 +204,7 @@ PeerImp::PeerImp (boost::asio::io_service& io_service, boost::asio::ssl::context
|
||||
mActivityTimer (io_service),
|
||||
mIOStrand (io_service)
|
||||
{
|
||||
WriteLog (lsDEBUG, Peer) << "CREATING PEER: " << ADDRESS (this);
|
||||
WriteLog (lsDEBUG, Peer) << "CREATING PEER: " << addressToString (this);
|
||||
}
|
||||
|
||||
void PeerImp::handleWrite (const boost::system::error_code& error, size_t bytes_transferred)
|
||||
@@ -215,7 +212,7 @@ void PeerImp::handleWrite (const boost::system::error_code& error, size_t bytes_
|
||||
// Call on IO strand
|
||||
#ifdef BEAST_DEBUG
|
||||
// if (!error)
|
||||
// std::cerr << "PeerImp::handleWrite bytes: "<< bytes_transferred << std::endl;
|
||||
// Log::out() << "PeerImp::handleWrite bytes: "<< bytes_transferred;
|
||||
#endif
|
||||
|
||||
mSendingPacket.reset ();
|
||||
@@ -227,7 +224,7 @@ void PeerImp::handleWrite (const boost::system::error_code& error, size_t bytes_
|
||||
}
|
||||
else if (error)
|
||||
{
|
||||
WriteLog (lsINFO, Peer) << "Peer: Write: Error: " << ADDRESS (this) << ": bytes=" << bytes_transferred << ": " << error.category ().name () << ": " << error.message () << ": " << error;
|
||||
WriteLog (lsINFO, Peer) << "Peer: Write: Error: " << addressToString (this) << ": bytes=" << bytes_transferred << ": " << error.category ().name () << ": " << error.message () << ": " << error;
|
||||
|
||||
detach ("hw", true);
|
||||
}
|
||||
@@ -249,7 +246,7 @@ void PeerImp::setIpPort (const std::string& strIP, int iPort)
|
||||
mLoad.rename (strIP);
|
||||
|
||||
WriteLog (lsDEBUG, Peer) << "Peer: Set: "
|
||||
<< ADDRESS (this) << "> "
|
||||
<< addressToString (this) << "> "
|
||||
<< (mNodePublic.isValid () ? mNodePublic.humanNodePublic () : "-") << " " << getIP () << " " << getPort ();
|
||||
}
|
||||
|
||||
@@ -272,7 +269,7 @@ void PeerImp::detach (const char* rsn, bool onIOStrand)
|
||||
CondLog (mCluster, lsWARNING, Peer) << "Cluster peer detach \"" << mNodeName << "\": " << rsn;
|
||||
/*
|
||||
WriteLog (lsDEBUG, Peer) << "Peer: Detach: "
|
||||
<< ADDRESS(this) << "> "
|
||||
<< addressToString(this) << "> "
|
||||
<< rsn << ": "
|
||||
<< (mNodePublic.isValid() ? mNodePublic.humanNodePublic() : "-") << " " << getIP() << " " << getPort();
|
||||
*/
|
||||
@@ -302,7 +299,7 @@ void PeerImp::detach (const char* rsn, bool onIOStrand)
|
||||
|
||||
/*
|
||||
WriteLog (lsDEBUG, Peer) << "Peer: Detach: "
|
||||
<< ADDRESS(this) << "< "
|
||||
<< addressToString(this) << "< "
|
||||
<< rsn << ": "
|
||||
<< (mNodePublic.isValid() ? mNodePublic.humanNodePublic() : "-") << " " << getIP() << " " << getPort();
|
||||
*/
|
||||
@@ -346,7 +343,7 @@ void PeerImp::handleVerifyTimer (const boost::system::error_code& ecResult)
|
||||
if (ecResult == boost::asio::error::operation_aborted)
|
||||
{
|
||||
// Timer canceled because deadline no longer needed.
|
||||
// std::cerr << "Deadline cancelled." << std::endl;
|
||||
// Log::out() << "Deadline cancelled.";
|
||||
|
||||
nothing (); // Aborter is done.
|
||||
}
|
||||
@@ -405,7 +402,7 @@ void PeerImp::connect (const std::string& strIp, int iPort)
|
||||
|
||||
if (!err)
|
||||
{
|
||||
WriteLog (lsINFO, Peer) << "Peer: Connect: Outbound: " << ADDRESS (this) << ": " << mIpPort.first << " " << mIpPort.second;
|
||||
WriteLog (lsINFO, Peer) << "Peer: Connect: Outbound: " << addressToString (this) << ": " << mIpPort.first << " " << mIpPort.second;
|
||||
|
||||
boost::asio::async_connect (
|
||||
getSocket (),
|
||||
@@ -488,7 +485,7 @@ void PeerImp::connected (const boost::system::error_code& error)
|
||||
{
|
||||
// Not redundant ip and port, handshake, and start.
|
||||
|
||||
WriteLog (lsINFO, Peer) << "Peer: Inbound: Accepted: " << ADDRESS (this) << ": " << strIp << " " << iPort;
|
||||
WriteLog (lsINFO, Peer) << "Peer: Inbound: Accepted: " << addressToString (this) << ": " << strIp << " " << iPort;
|
||||
|
||||
|
||||
mSocketSsl.set_verify_mode (boost::asio::ssl::verify_none);
|
||||
@@ -498,7 +495,7 @@ void PeerImp::connected (const boost::system::error_code& error)
|
||||
}
|
||||
else if (!mDetaching)
|
||||
{
|
||||
WriteLog (lsINFO, Peer) << "Peer: Inbound: Error: " << ADDRESS (this) << ": " << strIp << " " << iPort << " : " << error.category ().name () << ": " << error.message () << ": " << error;
|
||||
WriteLog (lsINFO, Peer) << "Peer: Inbound: Error: " << addressToString (this) << ": " << strIp << " " << iPort << " : " << error.category ().name () << ": " << error.message () << ": " << error;
|
||||
|
||||
detach ("ctd", false);
|
||||
}
|
||||
@@ -641,10 +638,10 @@ void PeerImp::processReadBuffer ()
|
||||
// must not hold peer lock
|
||||
int type = PackedMessage::getType (mReadbuf);
|
||||
#ifdef BEAST_DEBUG
|
||||
// std::cerr << "PRB(" << type << "), len=" << (mReadbuf.size()-PackedMessage::kHeaderBytes) << std::endl;
|
||||
// Log::out() << "PRB(" << type << "), len=" << (mReadbuf.size()-PackedMessage::kHeaderBytes);
|
||||
#endif
|
||||
|
||||
// std::cerr << "PeerImp::processReadBuffer: " << mIpPort.first << " " << mIpPort.second << std::endl;
|
||||
// Log::out() << "PeerImp::processReadBuffer: " << mIpPort.first << " " << mIpPort.second;
|
||||
|
||||
LoadEvent::autoptr event (getApp().getJobQueue ().getLoadEventAP (jtPEER, "PeerImp::read"));
|
||||
|
||||
@@ -1136,8 +1133,9 @@ void PeerImp::recvTransaction (protocol::TMTransaction& packet, ScopedLock& Mast
|
||||
catch (...)
|
||||
{
|
||||
#ifdef BEAST_DEBUG
|
||||
std::cerr << "Transaction from peer fails validity tests" << std::endl;
|
||||
Log::out() << "Transaction from peer fails validity tests";
|
||||
Json::StyledStreamWriter w;
|
||||
// VFALCO NOTE This bypasses the Log bottleneck
|
||||
w.write (std::cerr, tx->getJson (0));
|
||||
#endif
|
||||
return;
|
||||
@@ -1430,7 +1428,7 @@ void PeerImp::recvGetPeers (protocol::TMGetPeers& packet, ScopedLock& MasterLock
|
||||
addr->set_ipv4 (inet_addr (strIP.c_str ()));
|
||||
addr->set_ipv4port (iPort);
|
||||
|
||||
//WriteLog (lsINFO, Peer) << "Peer: Teaching: " << ADDRESS(this) << ": " << n << ": " << strIP << " " << iPort;
|
||||
//WriteLog (lsINFO, Peer) << "Peer: Teaching: " << addressToString(this) << ": " << n << ": " << strIP << " " << iPort;
|
||||
}
|
||||
|
||||
PackedMessage::pointer message = boost::make_shared<PackedMessage> (peers, protocol::mtPEERS);
|
||||
@@ -1452,7 +1450,7 @@ void PeerImp::recvPeers (protocol::TMPeers& packet)
|
||||
|
||||
if (strIP != "0.0.0.0" && strIP != "127.0.0.1")
|
||||
{
|
||||
//WriteLog (lsINFO, Peer) << "Peer: Learning: " << ADDRESS(this) << ": " << i << ": " << strIP << " " << iPort;
|
||||
//WriteLog (lsINFO, Peer) << "Peer: Learning: " << addressToString(this) << ": " << i << ": " << strIP << " " << iPort;
|
||||
|
||||
getApp().getPeers ().savePeer (strIP, iPort, IUniqueNodeList::vsTold);
|
||||
}
|
||||
@@ -2310,7 +2308,7 @@ Json::Value PeerImp::getJson ()
|
||||
{
|
||||
Json::Value ret (Json::objectValue);
|
||||
|
||||
//ret["this"] = ADDRESS(this);
|
||||
//ret["this"] = addressToString(this);
|
||||
ret["public_key"] = mNodePublic.ToString ();
|
||||
ret["ip"] = mIpPortConnect.first;
|
||||
//ret["port"] = mIpPortConnect.second;
|
||||
|
||||
@@ -196,7 +196,7 @@ bool Peers::savePeer (const std::string& strIp, int iPort, char code)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Error saving Peer" << std::endl;
|
||||
Log::out() << "Error saving Peer";
|
||||
}
|
||||
|
||||
if (bNew)
|
||||
|
||||
@@ -138,8 +138,8 @@ int SHAMapNode::selectBranch (uint256 const& hash) const
|
||||
|
||||
if ((hash & smMasks[mDepth]) != mNodeID)
|
||||
{
|
||||
std::cerr << "selectBranch(" << getString () << std::endl;
|
||||
std::cerr << " " << hash << " off branch" << std::endl;
|
||||
Log::out() << "selectBranch(" << getString ();
|
||||
Log::out() << " " << hash << " off branch";
|
||||
assert (false);
|
||||
return -1; // does not go under this node
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ SHAMapTreeNode::SHAMapTreeNode (const SHAMapNode& id, Blob const& rawNode, uint3
|
||||
if ((type < 0) || (type > 4))
|
||||
{
|
||||
#ifdef BEAST_DEBUG
|
||||
std::cerr << "Invalid wire format node" << std::endl;
|
||||
std::cerr << strHex (rawNode) << std::endl;
|
||||
Log::out() << "Invalid wire format node";
|
||||
Log::out() << strHex (rawNode);
|
||||
assert (false);
|
||||
#endif
|
||||
throw std::runtime_error ("invalid node AW type");
|
||||
|
||||
Reference in New Issue
Block a user