X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FLogger%2FTarget.ih;h=4b81e2eecce481234ce496ee985acdb9a2fd6dd6;hb=5443435c4c2b6e4386c5334b5b8358273f2bae93;hp=a0838719b46757d5f7f93247aa1e9af738c34bc7;hpb=4225875220d88a3a1c2b89a7ddae7ac864daa98d;p=senf.git diff --git a/Utils/Logger/Target.ih b/Utils/Logger/Target.ih index a083871..4b81e2e 100644 --- a/Utils/Logger/Target.ih +++ b/Utils/Logger/Target.ih @@ -30,18 +30,47 @@ #include #include #include +#include +#include "../Console/LazyDirectory.hh" +#include "../Console/Parse.hh" ///////////////////////////////ih.p//////////////////////////////////////// namespace senf { + + namespace console { class DirectoryNode; } + namespace log { namespace detail { + struct LogParameters { + StreamBase const * stream; + AreaBase const * area; + unsigned level; + void clear(); + void setDefaults(); + static LogParameters defaultParameters(); + }; + + std::ostream & operator<<(std::ostream & os, LogParameters const & pm); + + void senf_console_parse_argument(console::ParseCommandInfo::TokensRange const & tokens, + LogParameters & out); + /** \brief Internal: Target registry */ class TargetRegistry : public senf::singleton { 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, @@ -50,16 +79,31 @@ namespace detail { void routed(); bool fallbackRouting(); + senf::console::ScopedDirectory<> & consoleDir(); + + void dynamicTarget(std::auto_ptr target); + private: TargetRegistry(); + ~TargetRegistry(); - void registerTarget(Target * target); + void registerTarget(Target * target, std::string const & name); void unregisterTarget(Target * target); + void consoleAreas(std::ostream & os); + void consoleStreams(std::ostream & os); + void consoleWrite(LogParameters parameters, std::string const & msg); + void consoleRemoveTarget(Target * target); + boost::shared_ptr consoleSelf(std::ostream & os); + typedef std::set Targets; Targets targets_; bool fallbackRouting_; + + console::LazyDirectory consoleDir_; + + Targets dynamicTargets_; friend class senf::log::Target; friend class senf::singleton;