summaryrefslogtreecommitdiffstats
path: root/src/Daemon
diff options
context:
space:
mode:
authorJohannes Thorn <dante@g4t3.de>2008-09-28 00:35:16 +0200
committerJohannes Thorn <dante@g4t3.de>2008-09-28 00:35:16 +0200
commit29d723d82834a30557136f7585254eaf3673ce69 (patch)
tree2a6fa6686a709bc205036288c8f6c75cdccc050f /src/Daemon
parent37b452c361d99ca809c699b6968df3723f0cadb9 (diff)
downloadmad-29d723d82834a30557136f7585254eaf3673ce69.tar
mad-29d723d82834a30557136f7585254eaf3673ce69.zip
Logger gr?ndlich ?berarbeitet und den Networklogger um Timestamp erweitert.
Diffstat (limited to 'src/Daemon')
-rw-r--r--src/Daemon/Backends/NetworkLogger.h5
-rw-r--r--src/Daemon/Requests/LogRequest.cpp2
-rw-r--r--src/Daemon/Requests/LogRequest.h6
3 files changed, 8 insertions, 5 deletions
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 <Common/RequestManager.h>
#include <Daemon/Requests/LogRequest.h>
#include <Net/Connection.h>
+#include <ctime>
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<Common::RequestBase>(new Requests::LogRequest(category, level, message, Requests::LogRequest::slot_type()))
+ std::auto_ptr<Common::RequestBase>(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 <Common/Request.h>
#include <Common/Logger.h>
+#include <ctime>
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) {}
};
}