diff options
Diffstat (limited to 'src/lib/log.cc')
| -rw-r--r-- | src/lib/log.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/lib/log.cc b/src/lib/log.cc index 7f1eea206..650384bc7 100644 --- a/src/lib/log.cc +++ b/src/lib/log.cc @@ -42,7 +42,7 @@ Log::log (string m, Level l) if (l > _level) { return; } - + time_t t; time (&t); string a = ctime (&t); @@ -53,6 +53,23 @@ Log::log (string m, Level l) } void +Log::microsecond_log (string m, Level l) +{ + boost::mutex::scoped_lock lm (_mutex); + + if (l > _level) { + return; + } + + struct timeval tv; + gettimeofday (&tv, 0); + + stringstream s; + s << tv.tv_sec << ":" << tv.tv_usec << " " << m; + do_log (s.str ()); +} + +void Log::set_level (Level l) { boost::mutex::scoped_lock lm (_mutex); |
