00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00026 #ifndef IH_SENF_Utils_Logger_AreaRegistry_
00027 #define IH_SENF_Utils_Logger_AreaRegistry_ 1
00028
00029
00030 #include <string>
00031 #include <vector>
00032 #include <list>
00033 #include "Levels.hh"
00034 #include "TimeSource.hh"
00035
00036
00037
00038 namespace senf {
00039 namespace log {
00040
00041 class Target;
00042
00043 namespace detail {
00044
00045 class StreamBase;
00046
00048 struct AreaBase
00049 {
00050 AreaBase();
00051 virtual ~AreaBase();
00052
00053 std::string fullName() const;
00054 virtual std::string v_name() const;
00055
00056 void init();
00057 bool alive() const;
00058
00059 unsigned limit(StreamBase const & stream) const;
00060 void updateRoutingCache(Target & target, StreamBase const & stream, unsigned limit) const;
00061 void removeRoutingCache(Target & target, StreamBase const & stream) const;
00062 void write(time_type timestamp, StreamBase const & stream, unsigned level,
00063 std::string const & msg) const;
00064
00065 private:
00066 struct RouteEntry {
00067 RouteEntry(unsigned limit_, Target * target_) : limit(limit_), target(target_) {}
00068 unsigned limit;
00069 Target * target;
00070 };
00071 typedef std::list<RouteEntry> Routes;
00072 struct CacheEntry {
00073 CacheEntry() : limit (DISABLED::value), routes() {}
00074 unsigned limit;
00075 Routes routes;
00076 };
00077 typedef std::vector<CacheEntry> RoutingCache;
00078 mutable RoutingCache routingCache_;
00079 bool alive_;
00080 };
00081
00082 }}}
00083
00084
00085
00086 #endif
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097