17 #ifndef LogAgregator_H_ 18 #define LogAgregator_H_ 25 #include <unordered_map> 26 #include "DebugStream.h" 27 #include "LogServerTypes.h" 137 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;
164 iLog(
const std::shared_ptr<DebugStream>& l,
const std::string& nm ): log(l), name(nm) {}
165 std::shared_ptr<DebugStream> log;
169 inline bool operator < (
const iLog& r )
const 171 return name < r.name;
175 std::list<iLog> getLogList()
const;
176 std::list<iLog> getLogList(
const std::string& regexp_str )
const;
178 friend std::ostream& operator<<(std::ostream& os,
LogAgregator& la );
179 friend std::ostream& operator<<(std::ostream& os, std::shared_ptr<LogAgregator> la );
181 static std::vector<std::string> splitFirst(
const std::string& lname,
const std::string s =
"/" );
183 std::ostream& printLogList( std::ostream& os,
const std::string& regexp_str =
"" )
const;
184 static std::ostream& printLogList( std::ostream& os, std::list<iLog>& lst );
187 void logOnEvent(
const std::string& s );
188 void addLog( std::shared_ptr<DebugStream> l,
const std::string& lname,
bool connect );
189 void addLogAgregator( std::shared_ptr<LogAgregator> la,
const std::string& lname );
192 std::shared_ptr<DebugStream> findLog(
const std::string& lname )
const;
195 std::ostream& printTree(std::ostream& os,
const std::string& g_tab =
"")
const;
198 std::list<iLog> makeLogNameList(
const std::string& prefix )
const;
201 typedef std::unordered_map<std::string, std::shared_ptr<DebugStream>> LogMap;
204 typedef std::unordered_map<std::shared_ptr<DebugStream>, sigc::connection> ConnectionMap;
205 ConnectionMap conmap;
210 #endif // LogAgregator_H_ Definition: LogAgregator.h:162
Definition: DebugStream.h:91
Definition: CallbackTimer.h:29
virtual void logFile(const std::string &f, bool truncate=false) override
Sets the debugstreams' logfile to f.
Definition: LogAgregator.cc:48
Definition: LogAgregator.h:132
Debug::type level() const noexcept
Returns the current debug level.
Definition: DebugStream.h:114