X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FLogger%2FAreaRegistry.ih;h=e8773fe4093525d3b4d7230011adaa1c451c93b6;hb=044a1bfb46ce16c3daac307b8c684604b43dd4cf;hp=362c3f6411eee1769de23e307f480b86528033d6;hpb=61419d9a2e1060f7ede22fa19fd9d0b401bbc87a;p=senf.git diff --git a/Utils/Logger/AreaRegistry.ih b/Utils/Logger/AreaRegistry.ih index 362c3f6..e8773fe 100644 --- a/Utils/Logger/AreaRegistry.ih +++ b/Utils/Logger/AreaRegistry.ih @@ -29,11 +29,17 @@ // Custom includes #include #include +#include +#include +#include "Levels.hh" ///////////////////////////////ih.p//////////////////////////////////////// namespace senf { namespace log { + + class Target; + namespace detail { class StreamBase; @@ -48,13 +54,26 @@ namespace detail { void init(); - unsigned streamLimit(StreamBase const & stream) const; - void setStreamLimit(StreamBase const & stream, unsigned value) const; + unsigned limit(StreamBase const & stream) const; + void updateRoutingCache(Target & target, StreamBase const & stream, unsigned limit) const; + void removeRoutingCache(Target & target, StreamBase const & stream) const; + void write(boost::posix_time::ptime timestamp, StreamBase const & stream, unsigned level, + std::string msg) const; private: - typedef std::vector StreamLimits; - // mutable since this is a cache and may therefore change at unexpected places ... - mutable StreamLimits streamLimits_; + struct RouteEntry { + RouteEntry(unsigned limit_, Target * target_) : limit(limit_), target(target_) {} + unsigned limit; + Target * target; + }; + typedef std::list Routes; + struct CacheEntry { + CacheEntry() : limit (DISABLED::value), routes() {} + unsigned limit; + Routes routes; + }; + typedef std::vector RoutingCache; + mutable RoutingCache routingCache_; }; }}}