blob: 5c1e599981f835d5bdcb4d19204f2ef9ffc51340 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
|