| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #ifndef NETDATA_ND_LOG_FATAL_H |
| 4 | #define NETDATA_ND_LOG_FATAL_H |
| 5 | |
| 6 | #include "libnetdata/common.h" |
| 7 | |
| 8 | void netdata_logger_fatal( const char *file, const char *function, unsigned long line, const char *fmt, ... ) NORETURN PRINTFLIKE(4, 5); |
| 9 | |
| 10 | #define fatal(args...) netdata_logger_fatal(__FILE__, __FUNCTION__, __LINE__, ##args) |
| 11 | #define fatal_assert(expr) ((expr) ? (void)(0) : netdata_logger_fatal(__FILE__, __FUNCTION__, __LINE__, "Assertion `%s' failed", #expr)) |
| 12 | |
| 13 | #ifdef NETDATA_INTERNAL_CHECKS |
| 14 | #define internal_fatal(condition, args...) do { if(unlikely(condition)) netdata_logger_fatal(__FILE__, __FUNCTION__, __LINE__, ##args); } while(0) |
| 15 | #else |
| 16 | #define internal_fatal(args...) debug_dummy() |
| 17 | #endif |
| 18 | |
| 19 | #endif //NETDATA_ND_LOG_FATAL_H |