summaryrefslogtreecommitdiff
path: root/src/lib/log.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-09-18 02:07:59 +0100
committerCarl Hetherington <cth@carlh.net>2012-09-18 02:07:59 +0100
commit3c1b239453936128d1711ffa063ad4e1617b3e40 (patch)
tree060213367c651ca0ddccf1d9470b35886a687f6e /src/lib/log.cc
parent48794870183ac5c0dd2b4acc1f9c2e5d7349f284 (diff)
Sort of working log window.
Diffstat (limited to 'src/lib/log.cc')
-rw-r--r--src/lib/log.cc29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/lib/log.cc b/src/lib/log.cc
index accf3694d..7f1eea206 100644
--- a/src/lib/log.cc
+++ b/src/lib/log.cc
@@ -27,10 +27,8 @@
using namespace std;
-/** @param f Filename to write log to */
-Log::Log (string f)
- : _file (f)
- , _level (VERBOSE)
+Log::Log ()
+ : _level (VERBOSE)
{
}
@@ -45,13 +43,13 @@ Log::log (string m, Level l)
return;
}
- ofstream f (_file.c_str(), fstream::app);
-
time_t t;
time (&t);
string a = ctime (&t);
-
- f << a.substr (0, a.length() - 1) << ": " << m << "\n";
+
+ stringstream s;
+ s << a.substr (0, a.length() - 1) << ": " << m;
+ do_log (s.str ());
}
void
@@ -61,3 +59,18 @@ Log::set_level (Level l)
_level = l;
}
+
+/** @param file Filename to write log to */
+FileLog::FileLog (string file)
+ : _file (file)
+{
+
+}
+
+void
+FileLog::do_log (string m)
+{
+ ofstream f (_file.c_str(), fstream::app);
+ f << m << "\n";
+}
+