summaryrefslogtreecommitdiff
path: root/project2/common/loggers.h
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2012-04-21 17:07:41 +0000
committerrandomdan <randomdan@localhost>2012-04-21 17:07:41 +0000
commit6e48e0cab3c10146393639432af137ddfe0ebfeb (patch)
treeda31e0db371b65687de9ba069dc195f323af98f4 /project2/common/loggers.h
parentAdd support for simple mutations of XML output (node rearrangement) (diff)
downloadproject2-6e48e0cab3c10146393639432af137ddfe0ebfeb.tar.bz2
project2-6e48e0cab3c10146393639432af137ddfe0ebfeb.tar.xz
project2-6e48e0cab3c10146393639432af137ddfe0ebfeb.zip
Plugable loggers
Diffstat (limited to 'project2/common/loggers.h')
-rw-r--r--project2/common/loggers.h60
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
-