diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-12-16 14:38:14 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-12-16 14:38:14 +0000 |
| commit | e1d54b6b3a95b37e2e8e807387a725fe5d202c2c (patch) | |
| tree | 77a61e8d0e0b509f6f3eac764132e033a33bc2e1 /rotord/src/rendercontext.h | |
| parent | dd350193352573ac54c97c4b7c6256319cbe62f4 (diff) | |
context logging
Diffstat (limited to 'rotord/src/rendercontext.h')
| -rw-r--r-- | rotord/src/rendercontext.h | 48 |
1 files changed, 48 insertions, 0 deletions
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"<<endl; output_filename=graph_filename=graph_body=""; + + AutoPtr<SplitterChannel> splitterChannel(new SplitterChannel()); + AutoPtr<Channel> consoleChannel(new ConsoleChannel()); + AutoPtr<Channel> fileChannel(new FileChannel("Rotord_session_"+name+".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)); + + 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; |
