From: g0dil Date: Thu, 11 Oct 2007 06:33:44 +0000 (+0000) Subject: Utils/Logger: BUGFIX: add SENF_LOG_TPL variants which work with templatized log param... X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=9bfe0b87be0926193b5baf13865cf045f0de0b0d;p=senf.git Utils/Logger: BUGFIX: add SENF_LOG_TPL variants which work with templatized log parameters git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@460 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/PPI/DebugModules.cti b/PPI/DebugModules.cti index e9c7309..1c46d1a 100644 --- a/PPI/DebugModules.cti +++ b/PPI/DebugModules.cti @@ -48,7 +48,7 @@ template prefix_ void senf::ppi::module::debug::LogSink::request() { Packet packet (input()); - SENF_LOG_BLOCK((Stream)(Area)(Level)({ + 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.test.cc b/PPI/DebugModules.test.cc index a088012..2010198 100644 --- a/PPI/DebugModules.test.cc +++ b/PPI/DebugModules.test.cc @@ -36,7 +36,7 @@ namespace { std::stringstream logstream; } -#define SENF_LOG_CONF ((senf::log::Debug)(_)(VERBOSE)) +#define SENF_LOG_CONF (( (senf)(log)(Debug), (_), VERBOSE )) #include "../Packets/Packets.hh" #include "DebugModules.hh" diff --git a/Utils/Logger/Log.hh b/Utils/Logger/Log.hh index efb5143..072e893 100644 --- a/Utils/Logger/Log.hh +++ b/Utils/Logger/Log.hh @@ -51,6 +51,10 @@ SENF_LOG_BLOCK_( SENF_LOG_MERGE_PARAMETERS(BOOST_PP_SEQ_POP_BACK(args)), \ { log << BOOST_PP_SEQ_ELEM(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(args)),args); }) +#define SENF_LOG_TPL(args) \ + SENF_LOG_BLOCK_( SENF_LOG_MERGE_PARAMETERS_TPL(BOOST_PP_SEQ_POP_BACK(args)), \ + { log << BOOST_PP_SEQ_ELEM(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(args)),args); }) + /** \brief Enable block based on logging parameters This macro is like SENF_LOG, however instead of writing a simple message, this macro allows @@ -68,6 +72,10 @@ SENF_LOG_BLOCK_( SENF_LOG_MERGE_PARAMETERS(BOOST_PP_SEQ_POP_BACK(args)), \ BOOST_PP_SEQ_ELEM(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(args)),args)) +#define SENF_LOG_BLOCK_TPL(args) \ + SENF_LOG_BLOCK_( SENF_LOG_MERGE_PARAMETERS_TPL(BOOST_PP_SEQ_POP_BACK(args)), \ + BOOST_PP_SEQ_ELEM(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(args)),args)) + #define SENF_LOG_BLOCK_(parameters, block) \ do { \ if (parameters::compile_enabled && parameters::enabled()) { \ diff --git a/Utils/Logger/Parameters.ih b/Utils/Logger/Parameters.ih index 55d2aba..882af7c 100644 --- a/Utils/Logger/Parameters.ih +++ b/Utils/Logger/Parameters.ih @@ -126,6 +126,11 @@ namespace detail { senf::log::detail::empty, \ (SENFLogDefaultStream)(SENFLogDefaultArea)(SENFLogDefaultLevel)args) > +#define SENF_LOG_MERGE_PARAMETERS_TPL(args) \ + senf::log::detail::Parameters< typename SENF_LOG_MERGE_PARAMETERS_I( \ + senf::log::detail::empty, \ + (SENFLogDefaultStream)(SENFLogDefaultArea)(SENFLogDefaultLevel)args) > + ///////////////////////////////ih.e//////////////////////////////////////// #endif