using namespace std;
Log::Log ()
- : _level (VERBOSE)
+ : _level (STANDARD)
{
}
if (l > _level) {
return;
}
-
+
time_t t;
time (&t);
string a = ctime (&t);
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)
{
_level = l;
}
+void
+Log::set_level (string l)
+{
+ if (l == "verbose") {
+ set_level (VERBOSE);
+ return;
+ } else if (l == "timing") {
+ set_level (TIMING);
+ return;
+ }
+
+ set_level (STANDARD);
+}
/** @param file Filename to write log to */
FileLog::FileLog (string file)