va_end(args);
}
-static bool
-event_want_debug_log(struct event *event, const char *source_filename,
+#undef event_want_debug_log
+bool event_want_debug_log(struct event *event, const char *source_filename,
unsigned int source_linenum)
{
struct failure_context ctx = { .type = LOG_TYPE_DEBUG };
if (event->forced_debug)
- return TRUE;
-
- if (global_debug_log_filter != NULL &&
- event_filter_match_source(global_debug_log_filter, event,
- source_filename, source_linenum, &ctx))
- return TRUE;
- if (global_core_log_filter != NULL &&
- event_filter_match_source(global_core_log_filter, event,
- source_filename, source_linenum, &ctx))
- return TRUE;
- return FALSE;
+ event->sending_debug_log = TRUE;
+
+ else if (global_debug_log_filter != NULL &&
+ event_filter_match_source(global_debug_log_filter, event,
+ source_filename, source_linenum, &ctx))
+ event->sending_debug_log = TRUE;
+ else if (global_core_log_filter != NULL &&
+ event_filter_match_source(global_core_log_filter, event,
+ source_filename, source_linenum, &ctx))
+ event->sending_debug_log = TRUE;
+ else
+ event->sending_debug_log = FALSE;
+ return event->sending_debug_log;
}
+#undef event_want_debug
bool event_want_debug(struct event *event, const char *source_filename,
unsigned int source_linenum)
{
- event->sending_debug_log =
- event_want_debug_log(event, source_filename, source_linenum);
+ (void)event_want_debug_log(event, source_filename, source_linenum);
if (event->sending_debug_log)
return TRUE;
const char *fmt, ...) ATTR_FORMAT(4, 5);
#define e_debug(_event, ...) STMT_START { \
struct event *_tmp_event = (_event); \
- if (event_want_debug(_tmp_event, __FILE__, __LINE__)) \
+ if (event_want_debug(_tmp_event)) \
e_debug(_tmp_event, __FILE__, __LINE__, __VA_ARGS__); \
else \
event_send_abort(_tmp_event); \
} STMT_END
/* Returns TRUE if debug event should be sent (either logged or sent to
stats). */
+bool event_want_debug_log(struct event *event, const char *source_filename,
+ unsigned int source_linenum);
+#define event_want_debug_log(_event) event_want_debug_log((_event), __FILE__, __LINE__)
+
bool event_want_debug(struct event *event, const char *source_filename,
unsigned int source_linenum);
+#define event_want_debug(_event) event_want_debug((_event), __FILE__, __LINE__)
void event_log(struct event *event, const struct event_log_params *params,
const char *fmt, ...)