From 29d723d82834a30557136f7585254eaf3673ce69 Mon Sep 17 00:00:00 2001 From: Johannes Thorn Date: Sun, 28 Sep 2008 00:35:16 +0200 Subject: Logger gr?ndlich ?berarbeitet und den Networklogger um Timestamp erweitert. --- src/Daemon/Backends/NetworkLogger.h | 5 +++-- src/Daemon/Requests/LogRequest.cpp | 2 +- src/Daemon/Requests/LogRequest.h | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src/Daemon') diff --git a/src/Daemon/Backends/NetworkLogger.h b/src/Daemon/Backends/NetworkLogger.h index b2895d2..f1989bb 100644 --- a/src/Daemon/Backends/NetworkLogger.h +++ b/src/Daemon/Backends/NetworkLogger.h @@ -24,6 +24,7 @@ #include #include #include +#include namespace Mad { namespace Daemon { @@ -34,9 +35,9 @@ class NetworkLogger : public Common::Logger { Net::Connection *connection; protected: - virtual void logMessage(Common::Logger::MessageCategory category, Common::Logger::MessageLevel level, const std::string &message) { + virtual void logMessage(Common::Logger::MessageCategory category, Common::Logger::MessageLevel level, time_t messageTimestamp, const std::string &message) { Common::RequestManager::getRequestManager()->sendRequest(connection, - std::auto_ptr(new Requests::LogRequest(category, level, message, Requests::LogRequest::slot_type())) + std::auto_ptr(new Requests::LogRequest(category, level, messageTimestamp, message, Requests::LogRequest::slot_type())) ); } diff --git a/src/Daemon/Requests/LogRequest.cpp b/src/Daemon/Requests/LogRequest.cpp index 62115cc..3a04284 100644 --- a/src/Daemon/Requests/LogRequest.cpp +++ b/src/Daemon/Requests/LogRequest.cpp @@ -26,7 +26,7 @@ namespace Daemon { namespace Requests { void LogRequest::sendRequest(Net::Connection *connection, uint16_t requestId) { - connection->send(Net::Packets::LogPacket(Net::Packet::LOG, requestId, category, level, message)); + connection->send(Net::Packets::LogPacket(Net::Packet::LOG, requestId, category, level, messageTimestamp, message)); } void LogRequest::handlePacket(Net::Connection*, const Net::Packet &packet) { diff --git a/src/Daemon/Requests/LogRequest.h b/src/Daemon/Requests/LogRequest.h index a0a2e44..8d3798a 100644 --- a/src/Daemon/Requests/LogRequest.h +++ b/src/Daemon/Requests/LogRequest.h @@ -22,6 +22,7 @@ #include #include +#include namespace Mad { namespace Daemon { @@ -31,6 +32,7 @@ class LogRequest : public Common::Request<> { private: Common::Logger::MessageCategory category; Common::Logger::MessageLevel level; + time_t messageTimestamp; std::string message; protected: @@ -38,8 +40,8 @@ class LogRequest : public Common::Request<> { virtual void handlePacket(Net::Connection*, const Net::Packet &packet); public: - LogRequest(Common::Logger::MessageCategory category0, Common::Logger::MessageLevel level0, const std::string &message0, slot_type slot) - : Common::Request<>(slot), category(category0), level(level0), message(message0) {} + LogRequest(Common::Logger::MessageCategory category0, Common::Logger::MessageLevel level0, time_t messageTimestamp0, const std::string &message0, slot_type slot) + : Common::Request<>(slot), category(category0), level(level0), messageTimestamp(messageTimestamp0), message(message0) {} }; } -- cgit v1.2.3