29 lines
772 B
C
29 lines
772 B
C
#pragma once
|
|
|
|
enum {
|
|
LOG_TYPE_DEBUG = 0,
|
|
LOG_TYPE_INFO,
|
|
LOG_TYPE_WARN,
|
|
LOG_TYPE_ERROR,
|
|
LOG_TYPE_COUNT
|
|
};
|
|
|
|
#ifdef BUILD_DEBUG
|
|
#define LOG_ASSERT(condition, ...) \
|
|
do { if (!(condition)) { logger_write(LOG_TYPE_ERROR, __VA_ARGS__); fflush(stdout); abort(); } } while (0)
|
|
#define LOG_DEBUG(...) logger_write(LOG_TYPE_DEBUG, __VA_ARGS__)
|
|
#define LOG_INFO(...) logger_write(LOG_TYPE_INFO, __VA_ARGS__)
|
|
#define LOG_WARN(...) logger_write(LOG_TYPE_WARN, __VA_ARGS__)
|
|
#define LOG_ERROR(...) logger_write(LOG_TYPE_ERROR, __VA_ARGS__)
|
|
#else
|
|
#define LOG_ASSERT(condition, ...)
|
|
#define LOG_DEBUG(...)
|
|
#define LOG_INFO(...)
|
|
#define LOG_WARN(...)
|
|
#define LOG_ERROR(...) logger_write(LOG_TYPE_ERROR, __VA_ARGS__)
|
|
#endif
|
|
|
|
void
|
|
logger_write(int verbosity, char const* format, ...);
|
|
|