blob: 51089ecfa15f4126e091ea892da5a8ddcca9232c (
plain) (
blame)
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
|
#ifndef NEWSBOAT_LOGGER_H_
#define NEWSBOAT_LOGGER_H_
#include "config.h"
#include "strprintf.h"
#include "libnewsboat-ffi/src/logger.rs.h"
namespace newsboat {
using Level = Logger::Level;
namespace Logger {
template<typename... Args>
void log(Level l, const std::string& format, Args... args)
{
if (l == Level::USERERROR || static_cast<int64_t>(l) <= get_loglevel()) {
log_internal(l, strprintf::fmt(format, args...));
}
}
};
} // namespace newsboat
// see https://kernelnewbies.org/FAQ/DoWhile0
#ifdef NDEBUG
#define LOG(x, ...) \
do { \
} while (0)
#else
#define LOG(x, ...) \
do { \
newsboat::Logger::log(x, __VA_ARGS__); \
} while (0)
#endif
#endif /* NEWSBOAT_LOGGER_H_ */
|