#include "file_log.h"
#include "cross.h"
+#include "config.h"
#include <cstdio>
#include <iostream>
FileLog::FileLog (boost::filesystem::path file)
: _file (file)
{
+ _config_connection = Config::instance()->Changed.connect (boost::bind (&FileLog::config_changed, this));
+ config_changed ();
+}
+void
+FileLog::config_changed ()
+{
+ set_types (Config::instance()->log_types ());
}
void
private:
void do_log (boost::shared_ptr<const LogEntry> entry);
+ void config_changed ();
+
/** filename to write to */
boost::filesystem::path _file;
+ boost::signals2::scoped_connection _config_connection;
};
Log::Log ()
: _types (0)
{
- _config_connection = Config::instance()->Changed.connect (boost::bind (&Log::config_changed, this));
- config_changed ();
-}
-void
-Log::config_changed ()
-{
- set_types (Config::instance()->log_types ());
}
void
private:
virtual void do_log (boost::shared_ptr<const LogEntry> entry) = 0;
- void config_changed ();
/** bit-field of log types which should be put into the log (others are ignored) */
int _types;
- boost::signals2::scoped_connection _config_connection;
};
#endif