diff options
Diffstat (limited to 'project2/common/consoleLog.cpp')
-rw-r--r-- | project2/common/consoleLog.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/project2/common/consoleLog.cpp b/project2/common/consoleLog.cpp new file mode 100644 index 0000000..9c5c2d8 --- /dev/null +++ b/project2/common/consoleLog.cpp @@ -0,0 +1,20 @@ +#include "logger.h" + +/// Logger that writes to the console +class ConsoleLogDriver : public LogDriverBase { + public: + ConsoleLogDriver(int level, const std::string &) : + LogDriverBase(level) + { + } + void message(int priority, const char * msg) const + { + if (priority <= level) { + fprintf(stderr, "%s\n", msg); + fflush(stderr); + } + } +}; + +DECLARE_GENERIC_LOADER("console", LogDriverLoader, ConsoleLogDriver); + |