summaryrefslogtreecommitdiff
path: root/src/logger.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/logger.hh')
-rw-r--r--src/logger.hh33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/logger.hh b/src/logger.hh
new file mode 100644
index 0000000..8b0db05
--- /dev/null
+++ b/src/logger.hh
@@ -0,0 +1,33 @@
+// -*- mode: c++; c-basic-offset: 2; -*-
+
+#ifndef LOGGER_HH
+#define LOGGER_HH
+
+#include <string>
+
+class Logger {
+public:
+ virtual ~Logger() {}
+
+ enum Level {
+ ERR,
+ WARN,
+ INFO
+ };
+
+ static Logger* create_stderr();
+ static Logger* create_syslog(std::string const& name);
+ static Logger* create_file(std::string const& path);
+
+ virtual void out(Level lvl, char const* format, ...)
+#ifdef HAVE_FUNC_ATTRIBUTE_FORMAT
+ __attribute__ ((format (printf, 3, 4)))
+#endif
+ = 0;
+
+protected:
+ Logger() {}
+ Logger(Logger const&) = delete;
+};
+
+#endif // LOGGER_HH