diff options
Diffstat (limited to 'src/Daemon')
-rw-r--r-- | src/Daemon/Application.h | 4 | ||||
-rw-r--r-- | src/Daemon/Backends/NetworkLogger.h | 4 | ||||
-rw-r--r-- | src/Daemon/CMakeLists.txt | 13 | ||||
-rw-r--r-- | src/Daemon/RequestHandlers/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/Daemon/RequestHandlers/CommandRequestHandler.h | 4 | ||||
-rw-r--r-- | src/Daemon/Requests/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/Daemon/Requests/LogRequest.cpp | 4 | ||||
-rw-r--r-- | src/Daemon/Requests/LogRequest.h | 10 | ||||
-rw-r--r-- | src/Daemon/export.h | 11 |
9 files changed, 37 insertions, 23 deletions
diff --git a/src/Daemon/Application.h b/src/Daemon/Application.h index aed7b70..8469bf0 100644 --- a/src/Daemon/Application.h +++ b/src/Daemon/Application.h @@ -20,12 +20,14 @@ #ifndef MAD_DAEMON_APPLICATION_H_ #define MAD_DAEMON_APPLICATION_H_ +#include "export.h" + #include <Common/Application.h> namespace Mad { namespace Daemon { -class Application : public Common::Application { +class MAD_DAEMON_EXPORT Application : public Common::Application { public: Application(); }; diff --git a/src/Daemon/Backends/NetworkLogger.h b/src/Daemon/Backends/NetworkLogger.h index 4ef6f60..9965468 100644 --- a/src/Daemon/Backends/NetworkLogger.h +++ b/src/Daemon/Backends/NetworkLogger.h @@ -20,6 +20,8 @@ #ifndef MAD_DAEMON_BACKENDS_NETWORKLOGGER_H_ #define MAD_DAEMON_BACKENDS_NETWORKLOGGER_H_ +#include "../export.h" + #include <Common/RequestManager.h> #include <Daemon/Requests/LogRequest.h> @@ -33,7 +35,7 @@ class NetworkLogger : public Core::Logger { Common::Connection *connection; protected: - virtual void logMessage(Core::Logger::MessageCategory category, Core::Logger::MessageLevel level, time_t messageTimestamp, const std::string &message) { + virtual void logMessage(Core::Logger::MessageCategory category, Core::Logger::MessageLevel level, boost::posix_time::ptime messageTimestamp, const std::string &message) { boost::shared_ptr<Requests::LogRequest> request(new Requests::LogRequest(application, category, level, messageTimestamp, message)); application->getRequestManager()->sendRequest(connection, request); } diff --git a/src/Daemon/CMakeLists.txt b/src/Daemon/CMakeLists.txt index 151c229..3972429 100644 --- a/src/Daemon/CMakeLists.txt +++ b/src/Daemon/CMakeLists.txt @@ -1,11 +1,14 @@ -add_subdirectory(RequestHandlers) -add_subdirectory(Requests) - include_directories(${INCLUDES}) -add_library(Daemon +mad_library(Daemon + export.h + Backends/NetworkLogger.h + RequestHandlers/CommandRequestHandler.cpp RequestHandlers/CommandRequestHandler.h + + Requests/LogRequest.cpp Requests/LogRequest.h + Application.cpp Application.h ) -target_link_libraries(Daemon DaemonRequestHandlers DaemonRequests Common) +target_link_libraries(Daemon Common) diff --git a/src/Daemon/RequestHandlers/CMakeLists.txt b/src/Daemon/RequestHandlers/CMakeLists.txt deleted file mode 100644 index 21a2fbb..0000000 --- a/src/Daemon/RequestHandlers/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -include_directories(${INCLUDES}) - -add_library(DaemonRequestHandlers STATIC - CommandRequestHandler.cpp CommandRequestHandler.h -) diff --git a/src/Daemon/RequestHandlers/CommandRequestHandler.h b/src/Daemon/RequestHandlers/CommandRequestHandler.h index 87b4d1a..188b3d4 100644 --- a/src/Daemon/RequestHandlers/CommandRequestHandler.h +++ b/src/Daemon/RequestHandlers/CommandRequestHandler.h @@ -20,13 +20,15 @@ #ifndef MAD_DAEMON_REQUESTHANDLERS_COMMANDREQUESTHANDLER_H_ #define MAD_DAEMON_REQUESTHANDLERS_COMMANDREQUESTHANDLER_H_ +#include "../export.h" + #include <Common/RequestHandlers/SimpleRequestHandler.h> namespace Mad { namespace Daemon { namespace RequestHandlers { -class CommandRequestHandler : public Common::RequestHandlers::SimpleRequestHandler { +class MAD_DAEMON_EXPORT CommandRequestHandler : public Common::RequestHandlers::SimpleRequestHandler { private: void handleRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret); diff --git a/src/Daemon/Requests/CMakeLists.txt b/src/Daemon/Requests/CMakeLists.txt deleted file mode 100644 index 90eb542..0000000 --- a/src/Daemon/Requests/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -include_directories(${INCLUDES}) - -add_library(DaemonRequests STATIC - LogRequest.cpp LogRequest.h -) diff --git a/src/Daemon/Requests/LogRequest.cpp b/src/Daemon/Requests/LogRequest.cpp index f1469ca..2d12fc8 100644 --- a/src/Daemon/Requests/LogRequest.cpp +++ b/src/Daemon/Requests/LogRequest.cpp @@ -19,6 +19,8 @@ #include "LogRequest.h" +#include <boost/date_time/posix_time/posix_time.hpp> + namespace Mad { namespace Daemon { namespace Requests { @@ -30,7 +32,7 @@ void LogRequest::sendRequest() { packet.set("category", category); packet.set("level", level); - packet.set("timestamp", messageTimestamp); + packet.set("timestamp", boost::posix_time::to_iso_string(messageTimestamp)); packet.set("message", message); sendPacket(packet); diff --git a/src/Daemon/Requests/LogRequest.h b/src/Daemon/Requests/LogRequest.h index ecc36fb..49d5c6f 100644 --- a/src/Daemon/Requests/LogRequest.h +++ b/src/Daemon/Requests/LogRequest.h @@ -20,25 +20,27 @@ #ifndef MAD_DAEMON_REQUESTS_LOGREQUEST_H_ #define MAD_DAEMON_REQUESTS_LOGREQUEST_H_ +#include "../export.h" + #include <Common/Request.h> -#include <ctime> +#include <boost/date_time/posix_time/ptime.hpp> namespace Mad { namespace Daemon { namespace Requests { -class LogRequest : public Common::Request { +class MAD_DAEMON_EXPORT LogRequest : public Common::Request { private: Core::LoggerBase::MessageCategory category; Core::LoggerBase::MessageLevel level; - time_t messageTimestamp; + boost::posix_time::ptime messageTimestamp; std::string message; protected: virtual void sendRequest(); public: - LogRequest(Common::Application *application, Core::LoggerBase::MessageCategory category0, Core::LoggerBase::MessageLevel level0, time_t messageTimestamp0, const std::string &message0) + LogRequest(Common::Application *application, Core::LoggerBase::MessageCategory category0, Core::LoggerBase::MessageLevel level0, boost::posix_time::ptime messageTimestamp0, const std::string &message0) : Common::Request(application), category(category0), level(level0), messageTimestamp(messageTimestamp0), message(message0) {} }; diff --git a/src/Daemon/export.h b/src/Daemon/export.h new file mode 100644 index 0000000..1c5cf31 --- /dev/null +++ b/src/Daemon/export.h @@ -0,0 +1,11 @@ +#ifndef MAD_DAEMON_EXPORT +# ifdef _WIN32 +# ifdef MAD_DAEMON_EXPORTS +# define MAD_DAEMON_EXPORT _declspec(dllexport) +# else +# define MAD_DAEMON_EXPORT _declspec(dllimport) +# endif +# else +# define MAD_DAEMON_EXPORT +# endif +#endif |