Clean up some klogging annoyances.

This commit is contained in:
JoelKatz
2012-10-24 12:26:50 -07:00
parent 60fb930546
commit ab5afd223e
6 changed files with 14 additions and 13 deletions

View File

@@ -72,7 +72,6 @@ void Application::run()
if (!theConfig.DEBUG_LOGFILE.empty())
{ // Let DEBUG messages go to the file but only WARNING or higher to regular output
Log::setLogFile(theConfig.DEBUG_LOGFILE);
Log::setMinSeverity(lsWARNING);
LogPartition::setSeverity(lsDEBUG);
}

View File

@@ -101,11 +101,12 @@ std::string Log::rotateLog(void)
}
void Log::setMinSeverity(LogSeverity s)
void Log::setMinSeverity(LogSeverity s, bool all)
{
boost::recursive_mutex::scoped_lock sl(sLock);
sMinSeverity = s;
LogPartition::setSeverity(s);
if (all)
LogPartition::setSeverity(s);
}
LogSeverity Log::getMinSeverity()

View File

@@ -96,7 +96,7 @@ public:
static LogSeverity stringToSeverity(const std::string&);
static LogSeverity getMinSeverity();
static void setMinSeverity(LogSeverity);
static void setMinSeverity(LogSeverity, bool all);
static void setLogFile(boost::filesystem::path);
static std::string rotateLog(void);
};

View File

@@ -219,7 +219,7 @@ void Peer::handleConnect(const boost::system::error_code& error, boost::asio::ip
}
else
{
std::cerr << "Connect peer: success." << std::endl;
cLog(lsINFO) << "Connect peer: success.";
mSocketSsl.set_verify_mode(boost::asio::ssl::verify_none);

View File

@@ -1390,7 +1390,7 @@ Json::Value RPCServer::doProfile(const Json::Value &params)
if (iArgs >= 8 && "false" != params[7u].asString())
bSubmit = true;
Log::setMinSeverity(lsFATAL);
Log::setMinSeverity(lsFATAL, true);
boost::posix_time::ptime ptStart(boost::posix_time::microsec_clock::local_time());
@@ -2700,7 +2700,7 @@ Json::Value RPCServer::doLogLevel(const Json::Value& params)
LogSeverity sv = Log::stringToSeverity(params[0u].asString());
if (sv == lsINVALID)
return RPCError(rpcINVALID_PARAMS);
Log::setMinSeverity(sv);
Log::setMinSeverity(sv, true);
return RPCError(rpcSUCCESS);
}
@@ -2710,7 +2710,7 @@ Json::Value RPCServer::doLogLevel(const Json::Value& params)
if (sv == lsINVALID)
return RPCError(rpcINVALID_PARAMS);
if (params[2u].asString() == "base")
Log::setMinSeverity(sv);
Log::setMinSeverity(sv, false);
else if (!LogPartition::setSeverity(params[0u].asString(), sv))
return RPCError(rpcINVALID_PARAMS);
return RPCError(rpcSUCCESS);

View File

@@ -121,9 +121,10 @@ int main(int argc, char* argv[])
{
nothing();
}
else if (argc >= 2 && !strcmp(argv[1], "--test")) {
else if (argc >= 2 && !strcmp(argv[1], "--test"))
{
bTest = true;
Log::setMinSeverity(lsTRACE);
Log::setMinSeverity(lsTRACE, true);
}
else
{
@@ -143,9 +144,9 @@ int main(int argc, char* argv[])
}
if (vm.count("verbose"))
{
Log::setMinSeverity(lsTRACE);
}
Log::setMinSeverity(lsTRACE, true);
else if (!bTest)
Log::setMinSeverity(lsWARNING, true);
if (!iResult)
{