Merge master.
[dcpomatic.git] / src / lib / log.cc
index 86de21bddf8f586ab00c21005ace6c079ac4f977..a0b031589bf1836080c98c170c2fde1860df8dfe 100644 (file)
  *  @brief A very simple logging class.
  */
 
-#include <fstream>
 #include <time.h>
+#include <cstdio>
 #include "log.h"
+#include "cross.h"
 
 #include "i18n.h"
 
@@ -102,7 +103,13 @@ FileLog::FileLog (boost::filesystem::path file)
 void
 FileLog::do_log (string m)
 {
-       ofstream f (_file.string().c_str(), fstream::app);
-       f << m << N_("\n");
+       FILE* f = fopen_boost (_file, "a");
+       if (!f) {
+               cout << "(could not log to " << _file.string() << "): " << m << "\n";
+               return;
+       }
+
+       fprintf (f, "%s\n", m.c_str ());
+       fclose (f);
 }