137 static const std::string sep;
139 explicit LogAgregator(
const std::string& name, Debug::type t );
144 virtual void logFile(
const std::string& f,
bool truncate =
false )
override;
146 void add( std::shared_ptr<LogAgregator> log,
const std::string& lname =
"" );
147 void add( std::shared_ptr<DebugStream> log,
const std::string& lname =
"" );
149 std::shared_ptr<DebugStream> create(
const std::string& logname );
152 void addLevel(
const std::string& logname, Debug::type t );
153 void delLevel(
const std::string& logname, Debug::type t );
154 void level(
const std::string& logname, Debug::type t );
155 void offLogFile(
const std::string& logname );
156 void onLogFile(
const std::string& logname );
159 std::shared_ptr<DebugStream> getLog(
const std::string& logname );
160 bool logExist( std::shared_ptr<DebugStream>& l )
const;
161 std::shared_ptr<DebugStream> findByLogName(
const std::string& logname )
const;
166 iLog(
const std::shared_ptr<DebugStream>& l,
const std::string& nm ): log(l), name(nm) {}
167 std::shared_ptr<DebugStream> log;
171 inline bool operator < (
const iLog& r )
const
173 return name < r.name;
177 std::list<iLog> getLogList()
const;
178 std::list<iLog> getLogList(
const std::string& regexp_str )
const;
180 friend std::ostream& operator<<(std::ostream& os,
LogAgregator& la );
181 friend std::ostream& operator<<(std::ostream& os, std::shared_ptr<LogAgregator> la );
183 static std::vector<std::string> splitFirst(
const std::string& lname,
const std::string s =
"/" );
185 std::ostream& printLogList( std::ostream& os,
const std::string& regexp_str =
"" )
const;
186 static std::ostream& printLogList( std::ostream& os, std::list<iLog>& lst );
189 void logOnEvent(
const std::string& s );
190 void addLog( std::shared_ptr<DebugStream> l,
const std::string& lname,
bool connect );
191 void addLogAgregator( std::shared_ptr<LogAgregator> la,
const std::string& lname );
194 std::shared_ptr<DebugStream> findLog(
const std::string& lname )
const;
197 std::ostream& printTree(std::ostream& os,
const std::string& g_tab =
"")
const;
200 std::list<iLog> makeLogNameList(
const std::string& prefix )
const;
203 void getListByLogNameWithRule( std::list<iLog>& lst,
const std::regex& rule,
const std::string& prefix )
const;
206 typedef std::unordered_map<std::string, std::shared_ptr<DebugStream>> LogMap;
209 typedef std::unordered_map<std::shared_ptr<DebugStream>, sigc::connection> ConnectionMap;
210 ConnectionMap conmap;
virtual void logFile(const std::string &f, bool truncate=false) override
Sets the debugstreams' logfile to f.
Definition LogAgregator.cc:51