log: break after printing the log message

This commit is contained in:
Danny Robson 2016-04-06 13:50:44 +10:00
parent e321b9eee7
commit dd00f4167a

12
log.cpp
View File

@ -195,14 +195,8 @@ level_width (void)
void
util::log (util::level_t level, const std::string &msg)
{
// fire a breakpoint before the following early exit
if (needs_break (level))
breakpoint ();
static const util::level_t LOG_LEVEL = log_level ();
if (level > LOG_LEVEL)
return;
if (level <= LOG_LEVEL) {
static const size_t time_len = strlen("YYYY-mm-dd HHMMhSS") + 1;
std::string time_string (time_len - 1, '\0');
time_t unix_time = time (nullptr);
@ -225,6 +219,10 @@ util::log (util::level_t level, const std::string &msg)
<< "] " << msg << std::endl;
}
if (needs_break (level))
breakpoint ();
}
///////////////////////////////////////////////////////////////////////////////
util::scoped_logger::scoped_logger (util::level_t _level,