Fix Windows ERROR macro collision in logger

This commit is contained in:
Kelsi 2026-02-25 11:14:53 -08:00
parent e1614d55a2
commit 35384b2c52
3 changed files with 8 additions and 4 deletions

View file

@ -26,6 +26,10 @@ enum class LogLevel {
FATAL
};
// Avoid direct token use of `ERROR` at call sites because Windows headers
// define `ERROR` as a macro.
inline constexpr LogLevel kLogLevelError = LogLevel::ERROR;
class Logger {
public:
static Logger& getInstance();
@ -128,7 +132,7 @@ private:
#define LOG_ERROR(...) do { \
auto& _wowee_logger = wowee::core::Logger::getInstance(); \
if (_wowee_logger.shouldLog(wowee::core::LogLevel::ERROR)) { \
if (_wowee_logger.shouldLog(wowee::core::kLogLevelError)) { \
_wowee_logger.error(__VA_ARGS__); \
} \
} while (0)