projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into plot-audio
[dcpomatic.git]
/
src
/
lib
/
log.h
diff --git
a/src/lib/log.h
b/src/lib/log.h
index d32b368f5a2ed202c3b62658a51c79956bfc8546..3a2cfcbfd53e7882a61feaa03268738036a60b1f 100644
(file)
--- a/
src/lib/log.h
+++ b/
src/lib/log.h
@@
-29,32
+29,45
@@
/** @class Log
* @brief A very simple logging class.
/** @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:
*/
class Log
{
public:
- Log (std::string f);
+ Log ();
+ virtual ~Log () {}
enum Level {
STANDARD = 0,
enum Level {
STANDARD = 0,
- VERBOSE = 1
+ VERBOSE = 1,
+ TIMING = 2
};
void log (std::string m, Level l = STANDARD);
};
void log (std::string m, Level l = STANDARD);
+ void microsecond_log (std::string m, Level l = STANDARD);
void set_level (Level l);
void set_level (Level l);
+ void set_level (std::string l);
-pr
ivate:
- /** mutex to pr
event simultaneous writes to the file
*/
+pr
otected:
+ /** mutex to pr
otect the log
*/
boost::mutex _mutex;
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;
};
/** 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
#endif