diff options
author | Stefan Radomski <github@mintwerk.de> | 2016-12-12 15:19:14 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2016-12-12 15:19:14 (GMT) |
commit | 047a35fc691a348008cbfbf4c3d7722a6ec4f93e (patch) | |
tree | 362a55496c4185b0be5966073d43d00e1b0e27de /src/uscxml/debug | |
parent | dcac58f473789dd07e9094e61f819aef2fbc4b4a (diff) | |
download | uscxml-047a35fc691a348008cbfbf4c3d7722a6ec4f93e.zip uscxml-047a35fc691a348008cbfbf4c3d7722a6ec4f93e.tar.gz uscxml-047a35fc691a348008cbfbf4c3d7722a6ec4f93e.tar.bz2 |
Custom logging for interpreters
Diffstat (limited to 'src/uscxml/debug')
-rw-r--r-- | src/uscxml/debug/DebugSession.cpp | 2 | ||||
-rw-r--r-- | src/uscxml/debug/DebuggerServlet.cpp | 17 | ||||
-rw-r--r-- | src/uscxml/debug/DebuggerServlet.h | 37 |
3 files changed, 26 insertions, 30 deletions
diff --git a/src/uscxml/debug/DebugSession.cpp b/src/uscxml/debug/DebugSession.cpp index 5b68f8e..fff6fe1 100644 --- a/src/uscxml/debug/DebugSession.cpp +++ b/src/uscxml/debug/DebugSession.cpp @@ -215,7 +215,7 @@ void DebugSession::run(void* instance) { // return; // } } - LOG(USCXML_DEBUG) << "done"; + LOG(INSTANCE->_interpreter.getLogger(), USCXML_DEBUG) << "done"; } Data DebugSession::debugStop(const Data& data) { diff --git a/src/uscxml/debug/DebuggerServlet.cpp b/src/uscxml/debug/DebuggerServlet.cpp index 016d67c..56b43d5 100644 --- a/src/uscxml/debug/DebuggerServlet.cpp +++ b/src/uscxml/debug/DebuggerServlet.cpp @@ -238,6 +238,23 @@ void DebuggerServlet::processListSessions(const HTTPServer::Request& request) { returnData(request, replyData); } +std::shared_ptr<LoggerImpl> DebuggerServlet::create() { + assert(false); + return std::shared_ptr<LoggerImpl>(this); +} + +void DebuggerServlet::log(LogSeverity severity, const Event& event) { + pushData(std::shared_ptr<DebugSession>(), event.data); +} + +void DebuggerServlet::log(LogSeverity severity, const Data& data) { + pushData(std::shared_ptr<DebugSession>(), data); +} + +void DebuggerServlet::log(LogSeverity severity, const std::string& message) { + pushData(std::shared_ptr<DebugSession>(), Data(message)); +} + /* void DebuggerServlet::handle(const el::LogDispatchData* data) { } diff --git a/src/uscxml/debug/DebuggerServlet.h b/src/uscxml/debug/DebuggerServlet.h index 05e1397..8d487b2 100644 --- a/src/uscxml/debug/DebuggerServlet.h +++ b/src/uscxml/debug/DebuggerServlet.h @@ -21,7 +21,7 @@ #define DEBUGGERSERVLET_H_ATUMDA3G #include "uscxml/Common.h" -#include "uscxml/interpreter/Logging.h" +#include "uscxml/interpreter/LoggingImpl.h" #include "uscxml/util/BlockingQueue.h" #include "uscxml/server/HTTPServer.h" @@ -29,27 +29,8 @@ namespace uscxml { -class USCXML_API DebuggerServlet : public Debugger, public HTTPServlet, public Logger { +class USCXML_API DebuggerServlet : public Debugger, public HTTPServlet, public LoggerImpl { public: - class LogMessage : public Data { - public: -#if 0 - LogMessage(google::LogSeverity severity, const char* full_filename, - const char* base_filename, int line, - const struct ::tm* tm_time, - std::string message, std::string formatted) { - - compound["severity"] = severity; - compound["fullFilename"] = Data(full_filename, Data::VERBATIM); - compound["baseFilename"] = Data(base_filename, Data::VERBATIM); - compound["line"] = line; - compound["message"] = Data(message, Data::VERBATIM); - compound["time"] = Data(mktime((struct ::tm*)tm_time), Data::INTERPRETED); - compound["formatted"] = Data(formatted, Data::VERBATIM); - } -#endif - }; - virtual ~DebuggerServlet() {} // from Debugger @@ -85,14 +66,12 @@ public: // void processRemoveBreakPoint(const HTTPServer::Request& request); // void processPoll(const HTTPServer::Request& request); - // Logsink - /** - virtual void send(google::LogSeverity severity, const char* full_filename, - const char* base_filename, int line, - const struct ::tm* tm_time, - const char* message, size_t message_len); - void handle(const el::LogDispatchData* data); - */ + // Logger + virtual std::shared_ptr<LoggerImpl> create(); + + virtual void log(LogSeverity severity, const Event& event); + virtual void log(LogSeverity severity, const Data& data); + virtual void log(LogSeverity severity, const std::string& message); protected: void serverPushData(std::shared_ptr<DebugSession>); |