8 #include <kiba/core/config.h>
13 #define KB_MAX_LOG_ENTRY_SIZE 8192
75 #define STATIC_ASSERT static_assert
133 #define KB_ASSERT(expr, ...) \
137 write_log_entry(LOG_LEVEL_FATAL, __FILE__, __LINE__, "assertion for " #expr " failed: " __VA_ARGS__); \
141 #define KB_FATAL(...) write_log_entry(LOG_LEVEL_FATAL, __FILE__, __LINE__, __VA_ARGS__)
142 #define KB_ERROR(...) write_log_entry(LOG_LEVEL_ERROR, __FILE__, __LINE__, __VA_ARGS__)
144 #ifdef KB_DEBUG_BUILD
145 # define KB_WARN(...) write_log_entry(LOG_LEVEL_WARN, __FILE__, __LINE__, __VA_ARGS__)
146 # define KB_INFO(...) write_log_entry(LOG_LEVEL_INFO, __FILE__, __LINE__, __VA_ARGS__)
147 # define KB_DEBUG(...) write_log_entry(LOG_LEVEL_DEBUG, __FILE__, __LINE__, __VA_ARGS__)
148 # define KB_TRACE(...) write_log_entry(LOG_LEVEL_TRACE, __FILE__, __LINE__, __VA_ARGS__)
149 # define KB_ASSERT_DEBUG(expr, ...) \
153 write_log_entry(LOG_LEVEL_FATAL, \
156 "debug assertion for " #expr " failed: " __VA_ARGS__); \
161 # define KB_WARN(...)
162 # define KB_INFO(...)
163 # define KB_DEBUG(...)
164 # define KB_TRACE(...)
165 # define KB_ASSERT_DEBUG(expr, ...) \
KB_API void disable_stacktraces(void)
Disables output of the stacktrace.
KB_API void log_set_active_level(log_level level)
Set the minimum log level to log.
void write_log_entry(log_level level, const char *file, long int line, const char *msg,...)
Create log entry and write to output channel.
KB_API void enable_stacktraces(log_level level)
Enables output of the stacktrace.
log_level
Available log levels.
void write_to_console(log_level level, const char *msg)
Write string to console.