diff options
Diffstat (limited to 'project2/common/loggers.h')
-rw-r--r-- | project2/common/loggers.h | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/project2/common/loggers.h b/project2/common/loggers.h deleted file mode 100644 index 69b352c..0000000 --- a/project2/common/loggers.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef LOGGERS_H -#define LOGGERS_H - -#include "logger.h" - -/// Base class for classes providing a logging facility -class LogDriverBase : public virtual IntrusivePtrBase { - public: - LogDriverBase(int level); - virtual ~LogDriverBase(); - - virtual void message(int priority, const char * msg) const = 0; - const int level; -}; - -/// Base class for loggers that write to some sort of file handle -class FileBasedLogDriver : public LogDriverBase { - public: - FileBasedLogDriver(FILE *, int level, bool timestamp); - virtual ~FileBasedLogDriver() = 0; - - virtual void message(int priority, const char * msg) const; - - protected: - void writeTimestamp() const; - void writeLevel(int level) const; - FILE * file; - bool timestamp; - - private: - const char * timeStr() const; - mutable char tmbuf[30]; -}; - -/// Logger that writes to the console -class ConsoleLogDriver : public FileBasedLogDriver { - public: - ConsoleLogDriver(FILE *, int level, bool timestamp); - ~ConsoleLogDriver(); - -}; - -/// Logger that writes to a file -class FileLogDriver : public FileBasedLogDriver { - public: - FileLogDriver(const char * path, int level); - ~FileLogDriver(); -}; - -/// Logger that writes to syslog -class SyslogLogDriver : public LogDriverBase { - public: - SyslogLogDriver(const char * ident, int level, int option = 0, int facility = LOG_USER); - virtual ~SyslogLogDriver(); - - virtual void message(int priority, const char * msg) const; -}; - -#endif - |