swayfx/common/log.c

32 lines
528 B
C
Raw Normal View History

2016-09-01 22:18:37 +10:00
#include <signal.h>
#include <stdarg.h>
#include <stdlib.h>
2016-09-01 22:18:37 +10:00
#include "log.h"
2017-11-19 03:22:02 +11:00
void sway_terminate(int code);
2017-04-21 02:13:53 +10:00
void _sway_abort(const char *format, ...) {
2017-04-21 02:13:53 +10:00
va_list args;
va_start(args, format);
2018-07-10 07:54:30 +10:00
_wlr_vlog(WLR_ERROR, format, args);
2017-04-21 02:13:53 +10:00
va_end(args);
sway_terminate(EXIT_FAILURE);
}
bool _sway_assert(bool condition, const char *format, ...) {
if (condition) {
return true;
}
va_list args;
va_start(args, format);
2018-07-10 07:54:30 +10:00
_wlr_vlog(WLR_ERROR, format, args);
va_end(args);
#ifndef NDEBUG
raise(SIGABRT);
#endif
return false;
}