From: g0dil Date: Tue, 11 Aug 2009 20:07:01 +0000 (+0000) Subject: PPI: Replace LogSink with Logger monitor module X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=b9caf0c246335fe5abd9d07a668db82166cea31e;p=senf.git PPI: Replace LogSink with Logger monitor module git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1287 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/PPI/DebugModules.cti b/PPI/DebugModules.cti index d603cc8..f9b90d5 100644 --- a/PPI/DebugModules.cti +++ b/PPI/DebugModules.cti @@ -32,22 +32,19 @@ ///////////////////////////////cti.p/////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// -// senf::ppi::module::debug::LogSink +// senf::ppi::module::debug::Logger template -prefix_ senf::ppi::module::debug::LogSink::LogSink() -{ - noroute(input); - input.onRequest(&LogSink::request); -} +prefix_ senf::ppi::module::debug::Logger::Logger() +{} //////////////////////////////////////// // private members template -prefix_ void senf::ppi::module::debug::LogSink::request() +prefix_ void +senf::ppi::module::debug::Logger::v_handlePacket(Packet const & packet) { - Packet packet (input()); SENF_LOG_BLOCK_TPL((Stream)(Area)(Level)({ packet.dump(log); hexdump(packet.last().data().begin(), packet.last().data().end(),log); diff --git a/PPI/DebugModules.hh b/PPI/DebugModules.hh index 1ea0f2b..f382dd6 100644 --- a/PPI/DebugModules.hh +++ b/PPI/DebugModules.hh @@ -30,7 +30,7 @@ #include #include "../Utils/safe_bool.hh" #include "../Packets/Packets.hh" -#include "Module.hh" +#include "MonitorModule.hh" #include "ActiveFeeder.hh" #include "../Utils/Logger/SenfLog.hh" @@ -269,18 +269,15 @@ namespace debug { template < class Stream = log::Debug, class Area = log::DefaultArea, class Level = log::VERBOSE > - class LogSink - : public module::Module + class Logger + : public MonitorModule<> { - SENF_PPI_MODULE(LogSink); + SENF_PPI_MODULE(Logger); public: - - connector::PassiveInput<> input; - - LogSink(); + Logger(); private: - void request(); + virtual void v_handlePacket(Packet const & packet); }; }}}} diff --git a/PPI/DebugModules.test.cc b/PPI/DebugModules.test.cc index fa198bd..76a1d45 100644 --- a/PPI/DebugModules.test.cc +++ b/PPI/DebugModules.test.cc @@ -134,9 +134,9 @@ BOOST_AUTO_UNIT_TEST(logSink) logTarget.route(); debug::ActiveFeederSource source; - debug::LogSink<> sink; + debug::Logger<> logger; - ppi::connect(source,sink); + ppi::connect(source,logger); senf::PacketData::byte data[] = { 0x13u, 0x24u, 0x35u }; source.submit( senf::DataPacket::create(data) ); senf::ppi::run();