Move Log to ripple_basics and split websocket logging to ripple_net

This commit is contained in:
Vinnie Falco
2013-05-25 14:53:31 -07:00
parent 1f940b60c4
commit d762abfc85
49 changed files with 133 additions and 160 deletions

View File

@@ -24,6 +24,8 @@
#include "ripple_net.h"
#include "../websocketpp/src/logger/logger.hpp" // for ripple_LogWebSockets.cpp
// VFALCO: TODO, fix these warnings!
#ifdef _MSC_VER
//#pragma warning (push) // Causes spurious C4503 "decorated name exceeds maximum length"
@@ -53,6 +55,8 @@ static DH* handleTmpDh(SSL* ssl, int is_export, int iKeyLength)
#include "src/cpp/ripple/PeerDoor.cpp"
#include "src/cpp/ripple/WSDoor.cpp" // uses logging in WSConnection.h
#include "sockets/ripple_LogWebsockets.cpp"
#ifdef _MSC_VER
//#pragma warning (pop)
#endif

View File

@@ -0,0 +1,36 @@
namespace websocketpp
{
namespace log
{
LogPartition websocketPartition("WebSocket");
void websocketLog(websocketpp::log::alevel::value v, const std::string& entry)
{
if ((v == websocketpp::log::alevel::DEVEL) || (v == websocketpp::log::alevel::DEBUG_CLOSE))
{
if (websocketPartition.doLog(lsTRACE))
Log(lsDEBUG, websocketPartition) << entry;
}
else 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