diff options
| author | Joel Klinghed <the_jk@yahoo.com> | 2017-02-28 21:50:44 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@yahoo.com> | 2017-02-28 21:50:44 +0100 |
| commit | c029d90d1975e124d237605f1edb2be16bd05b5d (patch) | |
| tree | 9df87ffb365354bdb74a969440b32c8304bdbcb7 /src/logger.hh | |
Initial commit
Diffstat (limited to 'src/logger.hh')
| -rw-r--r-- | src/logger.hh | 33 |
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 |
