Some more debug logging.
[dcpomatic.git] / src / lib / log.cc
index 7f1eea20634f8cba480d8d6884765f7e1be14268..650384bc7726986ff97800613f0ef09f2a41346f 100644 (file)
@@ -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)
 {