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