X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FLogger%2FAreaRegistry.ih;h=41ca82bed16e763c4b7eab28c034647098437d49;hb=445c71d8d242f4ce3d23d8db8d1faf909943cfec;hp=362c3f6411eee1769de23e307f480b86528033d6;hpb=61419d9a2e1060f7ede22fa19fd9d0b401bbc87a;p=senf.git diff --git a/Utils/Logger/AreaRegistry.ih b/Utils/Logger/AreaRegistry.ih index 362c3f6..41ca82b 100644 --- a/Utils/Logger/AreaRegistry.ih +++ b/Utils/Logger/AreaRegistry.ih @@ -1,8 +1,8 @@ // $Id$ // -// Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// Copyright (C) 2007 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify @@ -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_; }; }}}