commit ed975875555f96a5f2742034bcc32f21b3392225 parent c222136b1d57b5e919ccc274f976275ee1ea46b1 Author: Michael Savage <mikejsavage@gmail.com> Date: Mon May 8 02:54:21 +0300 Print backtrace in FATAL Diffstat:
log.h | | | 8 | +++++++- |
diff --git a/log.h b/log.h @@ -2,6 +2,7 @@ #include <stdlib.h> +#include "platform_backtrace.h" #include "str.h" enum LogLevel { @@ -26,4 +27,9 @@ const char * logger_get_logs_dir(); #define INFO( form, ... ) logger_log( LOGLEVEL_INFO, "[INFO] " form, ##__VA_ARGS__ ) #define WARN( form, ... ) logger_log( LOGLEVEL_WARNING, "[WARN] " form, ##__VA_ARGS__ ) -#define FATAL( form, ... ) do { logger_log( LOGLEVEL_FATAL, "[FATAL] " form, ##__VA_ARGS__ ); abort(); } while( 0 ) +#define FATAL( form, ... ) \ + do { \ + logger_log( LOGLEVEL_FATAL, "[FATAL] " form, ##__VA_ARGS__ ); \ + print_backtrace(); \ + abort(); \ + } while( 0 )