|
|
@ -41,6 +41,8 @@ protected: |
|
|
|
, level(level) |
|
|
|
{} |
|
|
|
|
|
|
|
virtual ~LoggingBase(){} |
|
|
|
|
|
|
|
bool shouldSkip(){ |
|
|
|
return verbose < level; |
|
|
|
} |
|
|
@ -52,6 +54,8 @@ protected: |
|
|
|
struct Logger : public LoggingBase { |
|
|
|
Logger(std::ostream& logging_stream_, LoggingLevels level, std::string prefix_ = "") |
|
|
|
: LoggingBase(logging_stream_, level) |
|
|
|
, event_map() |
|
|
|
, event_name_stack() |
|
|
|
, prefix(prefix_) |
|
|
|
{} |
|
|
|
|
|
|
@ -62,9 +66,7 @@ struct Logger : public LoggingBase { |
|
|
|
|
|
|
|
void start(std::string what){ |
|
|
|
if (shouldSkip()) return; |
|
|
|
Event e; |
|
|
|
e.start = boost::posix_time::microsec_clock::local_time(); |
|
|
|
e.name = what; |
|
|
|
Event e(what); |
|
|
|
|
|
|
|
EventMap::iterator it = event_map.find(what); |
|
|
|
if(it != event_map.end()){ |
|
|
@ -97,6 +99,11 @@ private: |
|
|
|
} |
|
|
|
|
|
|
|
struct Event { |
|
|
|
Event(std::string const & name) |
|
|
|
: start(boost::posix_time::microsec_clock::local_time()) |
|
|
|
, end(boost::posix_time::microsec_clock::local_time()) |
|
|
|
, name(name) {} |
|
|
|
|
|
|
|
boost::posix_time::ptime start; |
|
|
|
boost::posix_time::ptime end; |
|
|
|
std::string name; |
|
|
|