X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Flog.h;h=641ce186d40cf72fdfaf8f75e571ea470e7c5d90;hb=71d8cf20889a3c419c9a3e485f461236e5317423;hp=2a242e24c96e8f49bfb171d81bac463085ad9f02;hpb=c0ed407fb02891f0dd364e78b6192f0e6dbe1d8d;p=dcpomatic.git diff --git a/src/lib/log.h b/src/lib/log.h index 2a242e24c..641ce186d 100644 --- a/src/lib/log.h +++ b/src/lib/log.h @@ -17,8 +17,8 @@ */ -#ifndef DVDOMATIC_LOG_H -#define DVDOMATIC_LOG_H +#ifndef DCPOMATIC_LOG_H +#define DCPOMATIC_LOG_H /** @file src/log.h * @brief A very simple logging class. @@ -26,23 +26,27 @@ #include #include +#include /** @class Log * @brief A very simple logging class. */ -class Log +class Log : public boost::noncopyable { public: Log (); + virtual ~Log () {} - enum Level { - STANDARD = 0, - VERBOSE = 1 - }; + static const int GENERAL; + static const int WARNING; + static const int ERROR; + static const int TIMING; - void log (std::string m, Level l = STANDARD); + void log (std::string message, int type); + void microsecond_log (std::string message, int type); - void set_level (Level l); + void set_types (int types); + void set_types (std::string types); protected: /** mutex to protect the log */ @@ -50,20 +54,29 @@ protected: private: virtual void do_log (std::string m) = 0; + void config_changed (); - /** level above which to ignore log messages */ - Level _level; + /** bit-field of log types which should be put into the log (others are ignored) */ + int _types; }; class FileLog : public Log { public: - FileLog (std::string file); + FileLog (boost::filesystem::path file); private: void do_log (std::string m); /** filename to write to */ - std::string _file; + boost::filesystem::path _file; +}; + +class NullLog : public Log +{ +public: + +private: + void do_log (std::string) {} }; #endif