mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Clean up some klogging annoyances.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -1390,7 +1390,7 @@ Json::Value RPCServer::doProfile(const Json::Value ¶ms)
|
||||
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);
|
||||
|
||||
11
src/main.cpp
11
src/main.cpp
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user