From e1d54b6b3a95b37e2e8e807387a725fe5d202c2c Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Mon, 16 Dec 2013 14:38:14 +0000 Subject: context logging --- rotord/src/rendercontext.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'rotord/src/rendercontext.h') diff --git a/rotord/src/rendercontext.h b/rotord/src/rendercontext.h index 380e197..202bc19 100644 --- a/rotord/src/rendercontext.h +++ b/rotord/src/rendercontext.h @@ -7,6 +7,28 @@ #include "rotor.h" #include "graph.h" +#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::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; + /*------------------------ Render context packages the management of a rotor graph as a web service @@ -72,6 +94,30 @@ namespace Rotor { else cerr<<"Rotor: settings.xml not found, using defaults"< splitterChannel(new SplitterChannel()); + AutoPtr consoleChannel(new ConsoleChannel()); + AutoPtr fileChannel(new FileChannel("Rotord_session_"+name+".log")); + //AutoPtr 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(new PatternFormatter("%d-%m-%Y %H:%M:%S %s: %t")); + AutoPtr formattingChannel(new FormattingChannel(formatter, splitterChannel)); + + Log_name="Context "+name; + graph.set_log_name(Log_name); + + Logger& sLog = Logger::create(Log_name, formattingChannel, Message::PRIO_TRACE); + + + Logger& logger = Logger::get(Log_name); + logger.information("started thread"); }; ~Render_context(){}; void runTask(); @@ -108,6 +154,8 @@ namespace Rotor { std::string graph_filename; std::string graph_body; + std::string Log_name; + Poco::Mutex mutex; //lock for access from parent thread Audio_thumbnailer *audio_thumb; -- cgit v1.2.3