Refactor Log code, add LogJournal adapter

This commit is contained in:
Vinnie Falco
2013-09-12 15:03:39 -07:00
parent 5038a65acd
commit b839ae0552
25 changed files with 802 additions and 577 deletions

View File

@@ -11,6 +11,15 @@ class Application;
SETUP_LOG (Application)
//------------------------------------------------------------------------------
//
// Specializations for LogPartition names
template <> char const* LogPartition::getPartitionName <Validators> () { return "Validators"; }
//
//------------------------------------------------------------------------------
// VFALCO TODO Move the function definitions into the class declaration
class ApplicationImp
: public Application
@@ -475,9 +484,9 @@ public:
if (!getConfig ().DEBUG_LOGFILE.empty ())
{
// Let debug messages go to the file but only WARNING or higher to regular output (unless verbose)
LogInstance::getInstance()->setLogFile (getConfig ().DEBUG_LOGFILE);
LogSink::get()->setLogFile (getConfig ().DEBUG_LOGFILE);
if (LogInstance::getInstance()->getMinSeverity () > lsDEBUG)
if (LogSink::get()->getMinSeverity () > lsDEBUG)
LogPartition::setSeverity (lsDEBUG);
}

View File

@@ -360,15 +360,15 @@ int RippleMain::run (int argc, char const* const* argv)
if (vm.count ("quiet"))
{
LogInstance::getInstance()->setMinSeverity (lsFATAL, true);
LogSink::get()->setMinSeverity (lsFATAL, true);
}
else if (vm.count ("verbose"))
{
LogInstance::getInstance()->setMinSeverity (lsTRACE, true);
LogSink::get()->setMinSeverity (lsTRACE, true);
}
else
{
LogInstance::getInstance()->setMinSeverity (lsINFO, true);
LogSink::get()->setMinSeverity (lsINFO, true);
}
// Run the unit tests if requested.

View File

@@ -826,7 +826,7 @@ Json::Value RPCHandler::doProfile (Json::Value params, LoadType* loadType, Appli
if (iArgs >= 8 && "false" != params[7u].asString())
bSubmit = true;
LogInstance::getInstance()->setMinSeverity(lsFATAL,true);
LogSink::get()->setMinSeverity(lsFATAL,true);
boost::posix_time::ptime ptStart(boost::posix_time::microsec_clock::local_time());
@@ -2387,7 +2387,7 @@ Json::Value RPCHandler::doWalletAccounts (Json::Value params, LoadType* loadType
Json::Value RPCHandler::doLogRotate (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
{
return LogInstance::getInstance()->rotateLog ();
return LogSink::get()->rotateLog ();
}
// {
@@ -2592,7 +2592,7 @@ Json::Value RPCHandler::doLogLevel (Json::Value params, LoadType* loadType, Appl
Json::Value ret (Json::objectValue);
Json::Value lev (Json::objectValue);
lev["base"] = Log::severityToString (LogInstance::getInstance()->getMinSeverity ());
lev["base"] = Log::severityToString (LogSink::get()->getMinSeverity ());
std::vector< std::pair<std::string, std::string> > logTable = LogPartition::getSeverities ();
typedef std::map<std::string, std::string>::value_type stringPair;
BOOST_FOREACH (const stringPair & it, logTable)
@@ -2611,7 +2611,7 @@ Json::Value RPCHandler::doLogLevel (Json::Value params, LoadType* loadType, Appl
if (!params.isMember ("partition"))
{
// set base log severity
LogInstance::getInstance()->setMinSeverity (sv, true);
LogSink::get()->setMinSeverity (sv, true);
return Json::objectValue;
}
@@ -2622,7 +2622,7 @@ Json::Value RPCHandler::doLogLevel (Json::Value params, LoadType* loadType, Appl
std::string partition (params["partition"].asString ());
if (boost::iequals (partition, "base"))
LogInstance::getInstance()->setMinSeverity (sv, false);
LogSink::get()->setMinSeverity (sv, false);
else if (!LogPartition::setSeverity (partition, sv))
return rpcError (rpcINVALID_PARAMS);