From c029d90d1975e124d237605f1edb2be16bd05b5d Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Tue, 28 Feb 2017 21:50:44 +0100 Subject: Initial commit --- src/logger.hh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/logger.hh (limited to 'src/logger.hh') 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 + +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 -- cgit v1.2.3-70-g09d2