summaryrefslogtreecommitdiff
path: root/src/lib/log.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-10-01 22:40:09 +0100
committerCarl Hetherington <cth@carlh.net>2012-10-01 22:40:09 +0100
commite1e7827d75df6ea11b6bfd2aabd3eb3fb1f2e701 (patch)
tree2770556b7584905023f5ff7c7de2028c1b9c279f /src/lib/log.cc
parent11307dfbddc463592f65cb0d24131bf5206c3617 (diff)
Some more debug logging.
Diffstat (limited to 'src/lib/log.cc')
-rw-r--r--src/lib/log.cc19
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);