X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Flog.cc;h=9ddf460d43ccc1c382270e607a7634a66be09049;hb=5b8fafecf252edfb1ef7bc9fe26c5e74c34d852d;hp=7459700eacd43b783da9b61673866f8535c929b4;hpb=32fc1ddb0ee004d18c36155ddcf4d9b3998a7061;p=dcpomatic.git diff --git a/src/lib/log.cc b/src/lib/log.cc index 7459700ea..9ddf460d4 100644 --- a/src/lib/log.cc +++ b/src/lib/log.cc @@ -21,9 +21,12 @@ * @brief A very simple logging class. */ -#include #include +#include #include "log.h" +#include "cross.h" + +#include "i18n.h" using namespace std; @@ -48,7 +51,7 @@ Log::log (string m, Level l) string a = ctime (&t); stringstream s; - s << a.substr (0, a.length() - 1) << ": " << m; + s << a.substr (0, a.length() - 1) << N_(": ") << m; do_log (s.str ()); } @@ -65,7 +68,7 @@ Log::microsecond_log (string m, Level l) gettimeofday (&tv, 0); stringstream s; - s << tv.tv_sec << ":" << tv.tv_usec << " " << m; + s << tv.tv_sec << N_(":") << tv.tv_usec << N_(" ") << m; do_log (s.str ()); } @@ -79,10 +82,10 @@ Log::set_level (Level l) void Log::set_level (string l) { - if (l == "verbose") { + if (l == N_("verbose")) { set_level (VERBOSE); return; - } else if (l == "timing") { + } else if (l == N_("timing")) { set_level (TIMING); return; } @@ -91,7 +94,7 @@ Log::set_level (string l) } /** @param file Filename to write log to */ -FileLog::FileLog (string file) +FileLog::FileLog (boost::filesystem::path file) : _file (file) { @@ -100,7 +103,8 @@ FileLog::FileLog (string file) void FileLog::do_log (string m) { - ofstream f (_file.c_str(), fstream::app); - f << m << "\n"; + FILE* f = fopen_boost (_file, "a"); + fprintf (f, "%s\n", m.c_str ()); + fclose (f); }