Files
djhackersdev_bemanitools/src/main/core/log-ext.h
T
icex2 7a6c3af9c8 feat: Add log-ext, handle win last errors
Helper to easily deal with GetLastError, log it and
make the application fail
2024-08-15 11:34:33 +02:00

22 lines
1.1 KiB
C

#ifndef CORE_LOG_EXT_H
#define CORE_LOG_EXT_H
#include "iface-core/log.h"
#define log_fatal_on_win_last_error(...) \
if (GetLastError() != 0) { \
_bt_core_log_api.v1.fatal( \
LOG_MODULE, \
"%s:%d: function `%s'", \
__FILE__, \
__LINE__, \
__FUNCTION__); \
_bt_core_log_api.v1.fatal(LOG_MODULE, __VA_ARGS__); \
core_log_ext_win_last_error_log(LOG_MODULE, _bt_core_log_api.v1.fatal); \
_bt_core_log_api.v1.fatal(LOG_MODULE, ""); \
abort(); \
}
void core_log_ext_win_last_error_log(const char *module, bt_core_log_message_t log_message);
#endif