summaryrefslogtreecommitdiff
path: root/rotord/rotord.h
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/rotord.h')
-rwxr-xr-xrotord/rotord.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/rotord/rotord.h b/rotord/rotord.h
index e9eb2a1..5b0e6ef 100755
--- a/rotord/rotord.h
+++ b/rotord/rotord.h
@@ -25,6 +25,15 @@
#include <sstream>
#include "Poco/URI.h"
+#include "Poco/Channel.h"
+#include "Poco/SplitterChannel.h"
+#include "Poco/ConsoleChannel.h"
+#include "Poco/FormattingChannel.h"
+#include "Poco/FileChannel.h"
+#include "Poco/Message.h"
+#include "Poco/Formatter.h"
+#include "Poco/PatternFormatter.h"
+#include "Poco/AutoPtr.h"
using Poco::Net::ServerSocket;
using Poco::Net::HTTPResponse;
@@ -46,6 +55,16 @@ using Poco::Util::OptionSet;
using Poco::Util::OptionCallback;
using Poco::Util::HelpFormatter;
using Poco::Net::HTTPStreamFactory;
+using Poco::Logger;
+using Poco::Channel;
+using Poco::SplitterChannel;
+using Poco::ConsoleChannel;
+using Poco::FormattingChannel;
+using Poco::Formatter;
+using Poco::PatternFormatter;
+using Poco::FileChannel;
+using Poco::Message;
+using Poco::AutoPtr;
#include "rotor.h"
@@ -56,6 +75,7 @@ class RotorRequestHandler: public HTTPRequestHandler
RotorRequestHandler(const std::string& format);
void handleRequest(HTTPServerRequest& request,HTTPServerResponse& response);
private:
+
std::string _format;
};
@@ -84,6 +104,7 @@ class RotorRequestHandlerFactory: public HTTPRequestHandlerFactory
public:
HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request);
private:
+
std::unordered_map<std::string,Rotor::Render_context> context;
Poco::UUIDGenerator idGen;
Poco::TaskManager manager;
@@ -106,6 +127,26 @@ class RotorServer: public Poco::Util::ServerApplication
int main(int argc, char** argv)
{
+ AutoPtr<SplitterChannel> splitterChannel(new SplitterChannel());
+ AutoPtr<Channel> consoleChannel(new ConsoleChannel());
+ AutoPtr<Channel> fileChannel(new FileChannel("Rotord.log"));
+ AutoPtr<FileChannel> rotatedFileChannel(new FileChannel("Rotord_R.log"));
+
+ rotatedFileChannel->setProperty("rotation", "100");
+ rotatedFileChannel->setProperty("archive", "timestamp");
+
+ splitterChannel->addChannel(consoleChannel);
+ splitterChannel->addChannel(fileChannel);
+ splitterChannel->addChannel(rotatedFileChannel);
+
+ AutoPtr<Formatter> formatter(new PatternFormatter("%d-%m-%Y %H:%M:%S %s: %t"));
+ AutoPtr<Channel> formattingChannel(new FormattingChannel(formatter, splitterChannel));
+
+ Logger& sLog = Logger::create("Rotor", formattingChannel, Message::PRIO_TRACE);
+
+ Logger& logger = Logger::get("Rotor");
+ logger.information("starting rendering daemon");
+
HTTPStreamFactory::registerFactory();
RotorServer app;
return app.run(argc, argv);