mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Catch websocketpp logs by diverting them to our logging system.
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "../websocketpp/src/logger/logger.hpp"
|
||||
|
||||
boost::recursive_mutex Log::sLock;
|
||||
|
||||
LogSeverity Log::sMinSeverity = lsINFO;
|
||||
@@ -186,3 +188,36 @@ void LogPartition::setSeverity(LogSeverity severity)
|
||||
for (LogPartition *p = headLog; p != NULL; p = p->mNextLog)
|
||||
p->mMinSeverity = severity;
|
||||
}
|
||||
|
||||
|
||||
namespace websocketpp
|
||||
{
|
||||
namespace log
|
||||
{
|
||||
LogPartition websocketPartition("WebSocket");
|
||||
|
||||
void websocketLog(websocketpp::log::alevel::value v, const std::string& entry)
|
||||
{
|
||||
if (websocketPartition.doLog(lsDEBUG))
|
||||
Log(lsDEBUG, websocketPartition) << entry;
|
||||
}
|
||||
|
||||
void websocketLog(websocketpp::log::elevel::value v, const std::string& entry)
|
||||
{
|
||||
LogSeverity s = lsDEBUG;
|
||||
if ((v & websocketpp::log::elevel::INFO) != 0)
|
||||
s = lsINFO;
|
||||
else if ((v & websocketpp::log::elevel::FATAL) != 0)
|
||||
s = lsFATAL;
|
||||
else if ((v & websocketpp::log::elevel::RERROR) != 0)
|
||||
s = lsERROR;
|
||||
else if ((v & websocketpp::log::elevel::WARN) != 0)
|
||||
s = lsWARNING;
|
||||
if (websocketPartition.doLog(s))
|
||||
Log(s, websocketPartition) << entry;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
Reference in New Issue
Block a user