summaryrefslogtreecommitdiffstats
path: root/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp')
-rw-r--r--src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp
index 0de73f9..e94853f 100644
--- a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp
+++ b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp
@@ -23,6 +23,8 @@
#include <Core/LogManager.h>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
namespace Mad {
namespace Server {
namespace RequestHandlers {
@@ -56,17 +58,27 @@ void ConnectionRequestHandlerGroup::handleIdentifyRequest(boost::shared_ptr<cons
void ConnectionRequestHandlerGroup::handleLogRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection) {
// TODO Require authentication
+
+ boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time);
+
+ const std::string &timestr = packet->get<const std::string&>("timestamp");
+ if(!timestr.empty()) {
+ try {
+ timestamp = boost::posix_time::from_iso_string(timestr);
+ }
+ catch(...) {}
+ }
try {
application->getLogManager()->log(
- packet->get<Core::LoggerBase::MessageCategory>("category"),
- packet->get<Core::LoggerBase::MessageLevel>("level"),
- packet->get<time_t>("timestamp"),
+ static_cast<Core::LoggerBase::MessageCategory>(packet->get<long>("category")),
+ static_cast<Core::LoggerBase::MessageLevel>(packet->get<long>("level")),
+ timestamp,
packet->get<const std::string&>("message"),
application->getConnectionManager()->getDaemonName(connection));
}
catch(Core::Exception &e) {
- application->logf(Core::LoggerBase::ERROR, "Can't determine daemon name: %s", e.strerror().c_str());
+ application->logf(Core::LoggerBase::LOG_ERROR, "Can't determine daemon name: %s", e.strerror().c_str());
}
ret->setType("OK");