reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
logging_macros.h
Go to the documentation of this file.
1
#include "
logging.h
"
2
11
#ifndef LOG_LEVEL
12
#define LOG_LEVEL LOG_LEVEL_INFO
13
#endif
14
32
#define LF_PRINT_LOG(format, ...) \
33
do { \
34
if (LOG_LEVEL >= LOG_LEVEL_LOG) { \
35
lf_print_log(format, ##__VA_ARGS__); \
36
} \
37
} while (0)
38
55
#define LF_PRINT_DEBUG(format, ...) \
56
do { \
57
if (LOG_LEVEL >= LOG_LEVEL_DEBUG) { \
58
lf_print_debug(format, ##__VA_ARGS__); \
59
} \
60
} while (0)
61
76
#if defined(NDEBUG)
77
#define LF_ASSERT(condition, format, ...) (void)(condition)
78
#define LF_ASSERTN(condition, format, ...) (void)(condition)
79
#define LF_ASSERT_NON_NULL(pointer) (void)(pointer)
80
#else
81
#define LF_ASSERT(condition, format, ...) \
82
do { \
83
if (!(condition)) { \
84
lf_print_error_and_exit("`" format "`. Failed assertion in %s:%d(%s):(" #condition ") != true`", ##__VA_ARGS__, \
85
__FILE__, __LINE__, __func__); \
86
} \
87
} while (0)
88
#define LF_ASSERTN(condition, format, ...) \
89
do { \
90
if (condition) { \
91
lf_print_error_and_exit("`" format "`. Failed assertion in %s:%d(%s):(" #condition ") != false`", ##__VA_ARGS__, \
92
__FILE__, __LINE__, __func__); \
93
} \
94
} while (0)
95
#define LF_ASSERT_NON_NULL(pointer) \
96
do { \
97
if (!(pointer)) { \
98
lf_print_error_and_exit("`Out of memory?` Assertion failed in %s:%d(%s):`" #pointer " == NULL`", __FILE__, \
99
__LINE__, __func__); \
100
} \
101
} while (0)
102
#endif
// NDEBUG
logging.h
logging
api
logging_macros.h
Generated by
1.10.0