From e1e7827d75df6ea11b6bfd2aabd3eb3fb1f2e701 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 1 Oct 2012 22:40:09 +0100 Subject: Some more debug logging. --- src/lib/log.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/lib/log.cc') 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); @@ -52,6 +52,23 @@ Log::log (string m, Level l) do_log (s.str ()); } +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) { -- cgit v1.2.3