X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Flog.h;h=2a242e24c96e8f49bfb171d81bac463085ad9f02;hb=3c1b239453936128d1711ffa063ad4e1617b3e40;hp=d32b368f5a2ed202c3b62658a51c79956bfc8546;hpb=1e8f1be709e8a3fa58f1147db2e58a39396313d8;p=dcpomatic.git diff --git a/src/lib/log.h b/src/lib/log.h index d32b368f5..2a242e24c 100644 --- a/src/lib/log.h +++ b/src/lib/log.h @@ -29,15 +29,11 @@ /** @class Log * @brief A very simple logging class. - * - * This class simply accepts log messages and writes them to a file. - * Its single nod to complexity is that it has a mutex to prevent - * multi-thread logging from clashing. */ class Log { public: - Log (std::string f); + Log (); enum Level { STANDARD = 0, @@ -48,13 +44,26 @@ public: void set_level (Level l); -private: - /** mutex to prevent simultaneous writes to the file */ +protected: + /** mutex to protect the log */ boost::mutex _mutex; - /** filename to write to */ - std::string _file; + +private: + virtual void do_log (std::string m) = 0; + /** level above which to ignore log messages */ Level _level; }; +class FileLog : public Log +{ +public: + FileLog (std::string file); + +private: + void do_log (std::string m); + /** filename to write to */ + std::string _file; +}; + #endif