diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-10-08 00:58:42 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-10-19 00:13:47 +0200 |
| commit | 86ec0b5386fc2078891a829026844d2ec21ea7db (patch) | |
| tree | 5f3ed650bc2957e06fd3c8c1ecfa7c6e7fc825b6 /src/logger.hh | |
| parent | 3a002fb9c23fc9a6384bc1b30a8e364924bb574e (diff) | |
Add http module and implement basic http server
Diffstat (limited to 'src/logger.hh')
| -rw-r--r-- | src/logger.hh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/logger.hh b/src/logger.hh new file mode 100644 index 0000000..5c1e599 --- /dev/null +++ b/src/logger.hh @@ -0,0 +1,41 @@ +#ifndef LOGGER_HH +#define LOGGER_HH + +#include <memory> +#include <string> +#include <string_view> + +namespace logger { + +class Logger { + public: + virtual ~Logger() = default; + + virtual void err(std::string_view message) = 0; + virtual void warn(std::string_view message) = 0; + virtual void info(std::string_view message) = 0; + +#if defined(NDEBUG) + void dbg(std::string_view) {} +#else + virtual void dbg(std::string_view message) = 0; +#endif + + protected: + Logger() = default; + Logger(Logger const&) = delete; + Logger& operator=(Logger const&) = delete; +}; + +[[nodiscard]] +std::unique_ptr<Logger> noop(); + +[[nodiscard]] +std::unique_ptr<Logger> syslog(std::string ident, bool verbose = false); + +[[nodiscard]] +std::unique_ptr<Logger> stderr(bool verbose = false); + +} // namespace logger + +#endif // LOGGER_HH |
