std::shared_ptr
[dcpomatic.git] / src / lib / file_log.cc
index be532c10fb648adab268b13c6d3c2401b5d72aae..481624c2a865136f3cc3aac83b6dc64663efe661 100644 (file)
 #include "config.h"
 #include <cstdio>
 #include <iostream>
+#include <cerrno>
 
 using std::cout;
 using std::string;
 using std::max;
-using boost::shared_ptr;
+using std::shared_ptr;
 
 /** @param file Filename to write log to */
 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;
        }