#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
{
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;
}