From: g0dil Date: Fri, 6 Feb 2009 23:24:00 +0000 (+0000) Subject: Utils/Logger: Add 'message' console command X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=4e05bff7db89ed83bfe3846c56273c7c91c6be59;p=senf.git Utils/Logger: Add 'message' console command git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1104 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Utils/Logger/AreaRegistry.hh b/Utils/Logger/AreaRegistry.hh index 386bb2c..82a43ed 100644 --- a/Utils/Logger/AreaRegistry.hh +++ b/Utils/Logger/AreaRegistry.hh @@ -77,11 +77,12 @@ namespace log { iterator begin(); ///< Beginning of area name sequence iterator end(); ///< End of area name sequence + detail::AreaBase const * lookup(std::string const & name); + private: AreaRegistry(); void registerArea(detail::AreaBase const & area); - detail::AreaBase const * lookup(std::string const & name); Registry registry_; diff --git a/Utils/Logger/StreamRegistry.hh b/Utils/Logger/StreamRegistry.hh index c35b69d..1d098db 100644 --- a/Utils/Logger/StreamRegistry.hh +++ b/Utils/Logger/StreamRegistry.hh @@ -75,11 +75,12 @@ namespace log { iterator begin(); iterator end(); + detail::StreamBase const * lookup(std::string const & name); + private: StreamRegistry(); void registerStream(detail::StreamBase const & stream); - detail::StreamBase const * lookup(std::string const & name); Registry registry_; diff --git a/Utils/Logger/Target.cc b/Utils/Logger/Target.cc index 2760ae3..38742bc 100644 --- a/Utils/Logger/Target.cc +++ b/Utils/Logger/Target.cc @@ -46,23 +46,12 @@ namespace log { SENF_CONSOLE_REGISTER_ENUM_MEMBER( Target, action_t, (ACCEPT)(REJECT) ); -}} +namespace detail { -namespace { -namespace local { - - enum Level { - VERBOSE = senf::log::VERBOSE::value, - NOTICE = senf::log::NOTICE::value, - MESSAGE = senf::log::MESSAGE::value, - IMPORTANT = senf::log::IMPORTANT::value, - CRITICAL = senf::log::CRITICAL::value, - FATAL = senf::log::FATAL::value - }; - SENF_CONSOLE_REGISTER_ENUM( Level, - (VERBOSE)(NOTICE)(MESSAGE)(IMPORTANT)(CRITICAL)(FATAL) ); - -}} + SENF_CONSOLE_REGISTER_ENUM_MEMBER( TargetRegistry, Level, + (VERBOSE)(NOTICE)(MESSAGE)(IMPORTANT)(CRITICAL)(FATAL) ); + +}}} prefix_ senf::log::Target::Target(std::string const & name) { @@ -82,7 +71,7 @@ prefix_ senf::log::Target::Target(std::string const & name) " ACTION action to take: accept or reject"); consoleDir_().add("route", boost::function( + detail::TargetRegistry::Level, action_t, int)>( senf::membind( static_cast( + detail::TargetRegistry::Level, action_t)>( senf::membind( static_cast { public: + enum Level { + VERBOSE = senf::log::VERBOSE::value, + NOTICE = senf::log::NOTICE::value, + MESSAGE = senf::log::MESSAGE::value, + IMPORTANT = senf::log::IMPORTANT::value, + CRITICAL = senf::log::CRITICAL::value, + FATAL = senf::log::FATAL::value + }; + using senf::singleton::instance; void write(StreamBase const & stream, AreaBase const & area, unsigned level, @@ -59,6 +68,8 @@ namespace detail { void consoleAreas(std::ostream & os); void consoleStreams(std::ostream & os); + void consoleWrite(std::string const & stream, std::string const & area, Level level, + std::string const & msg); typedef std::set Targets; Targets targets_;