6 /* Returns c-string "s" if n > 1, empty string "" otherwise. */
7 #define ESSE(n) (misc::str_esse + ((n) <= 1))
10 extern const char str_esse[];
13 /* Returns true if the given priority is enabled for the default
14 * category. Priority is xbt_log_priority_SUFFIX, where SUFFIX may
15 * be: trace, debug, verbose, info, warning, error, critical.
17 #define LOG_ISENABLED(priority) \
18 (_XBT_LOG_ISENABLEDV((*_XBT_LOGV(default)), (priority)))
21 # define XBT_CLOG_(catv, prio, ...) \
23 if (_XBT_LOG_ISENABLEDV(catv, prio)) { \
24 s_xbt_log_event_t _log_ev; \
25 _log_ev.cat = &(catv); \
26 _log_ev.priority = (prio); \
27 _log_ev.fileName = __FILE__; \
28 _log_ev.functionName = _XBT_FUNCTION; \
29 _log_ev.lineNum = __LINE__; \
30 memset(_log_ev.buffer, 0, XBT_LOG_BUFF_SIZE); \
31 _xbt_log_event_log(&_log_ev, __VA_ARGS__); \
34 # define XBT_CLOG(c, p, ...) XBT_CLOG_(_XBT_LOGV(c), p, __VA_ARGS__)
35 # define XBT_CDEBUG(c, ...) XBT_CLOG(c, xbt_log_priority_debug, __VA_ARGS__)
36 # define XBT_CVERB(c, ...) XBT_CLOG(c, xbt_log_priority_verbose, __VA_ARGS__)
37 # define XBT_CINFO(c, ...) XBT_CLOG(c, xbt_log_priority_info, __VA_ARGS__)
38 # define XBT_CWARN(c, ...) XBT_CLOG(c, xbt_log_priority_warning, __VA_ARGS__)
39 # define XBT_CERROR(c, ...) XBT_CLOG(c, xbt_log_priority_error, __VA_ARGS__)
40 # define XBT_CCRITICAL(c, ...) XBT_CLOG(c, xbt_log_priority_critical, __VA_ARGS__)
41 # define XBT_LOG(...) XBT_CLOG_((*_XBT_LOGV(default)), __VA_ARGS__)
42 # define XBT_DEBUG(...) XBT_LOG(xbt_log_priority_debug, __VA_ARGS__)
43 # define XBT_VERB(...) XBT_LOG(xbt_log_priority_verbose, __VA_ARGS__)
44 # define XBT_INFO(...) XBT_LOG(xbt_log_priority_info, __VA_ARGS__)
45 # define XBT_WARN(...) XBT_LOG(xbt_log_priority_warning, __VA_ARGS__)
46 # define XBT_ERROR(...) XBT_LOG(xbt_log_priority_error, __VA_ARGS__)
47 # define XBT_CRITICAL(...) XBT_LOG(xbt_log_priority_critical, __VA_ARGS__)
50 /* Defines XBT_XCLOG(...) which behave like XBT_CLOG(...), except that the
51 * given category is not passed through _XBT_LOGV before use.
53 #define XBT_XCLOG(c, p, ...) XBT_CLOG_((*(c)), p, __VA_ARGS__)