Rename TYPE_DEBUG_PLAYER to TYPE_DEBUG_VIDEO_VIEW.
[dcpomatic.git] / src / lib / file_log.cc
index be532c10fb648adab268b13c6d3c2401b5d72aae..b9aa84c3d9ff2aa957f84f01714fb1cbc1def2f9 100644 (file)
@@ -23,6 +23,7 @@
 #include "config.h"
 #include <cstdio>
 #include <iostream>
+#include <cerrno>
 
 using std::cout;
 using std::string;
@@ -33,14 +34,13 @@ using boost::shared_ptr;
 FileLog::FileLog (boost::filesystem::path file)
        : _file (file)
 {
-       _config_connection = Config::instance()->Changed.connect (boost::bind (&FileLog::config_changed, this));
-       config_changed ();
+       set_types (Config::instance()->log_types());
 }
 
-void
-FileLog::config_changed ()
+FileLog::FileLog (boost::filesystem::path file, int types)
+       : _file (file)
 {
-       set_types (Config::instance()->log_types ());
+       set_types (types);
 }
 
 void
@@ -48,7 +48,7 @@ FileLog::do_log (shared_ptr<const LogEntry> entry)
 {
        FILE* f = fopen_boost (_file, "a");
        if (!f) {
-               cout << "(could not log to " << _file.string() << "): " << entry.get() << "\n";
+               cout << "(could not log to " << _file.string() << " error " << errno << "): " << entry->get() << "\n";
                return;
        }