kr_log_level_set(level);
}
+static inline bool req_has_trace_log(const struct kr_request *req)
+{
+ return unlikely(req && req->trace_log);
+}
+
static void kr_vlog_req(
const struct kr_request * const req, uint32_t qry_uid,
const unsigned int indent, enum kr_log_group group, const char *tag, const char *fmt,
msg = mp_vprintf_append(mp, msg, fmt, args);
- if (kr_log_rtrace_enabled(req))
+ if (req_has_trace_log(req))
req->trace_log(req, msg);
kr_log_fmt(group, LOG_DEBUG, SD_JOURNAL_METADATA, "[%-6s]%s", tag, msg);
bool kr_log_is_debug_fun(enum kr_log_group group, const struct kr_request *req)
{
- return kr_log_rtrace_enabled(req)
+ return req_has_trace_log(req)
|| kr_log_group_is_set(group)
|| KR_LOG_LEVEL_IS(LOG_DEBUG);
}
return result;
}
-/**
- * @brief Return true if the query has request log handler installed.
- */
-#define kr_log_rtrace_enabled(req) (__builtin_expect( \
- (req) && (req)->trace_log, \
- false))
-
-#define kr_log_qtrace_enabled(qry) (__builtin_expect( \
- (qry) && kr_log_rtrace_enabled(qry->request), \
- false))
-
#define KR_DNAME_GET_STR(dname_str, dname) \
char dname_str[KR_DNAME_STR_MAXLEN]; \
knot_dname_to_str(dname_str, (dname), sizeof(dname_str)); \