/* ^^ here we use the *expanded* wildcard name */
if (new_ttl < 0 || eh->rank < lowest_rank || eh->is_packet) {
/* Wildcard record with stale TTL, bad rank or packet. */
- VERBOSE_MSG(qry, "=> wildcard: skipping %s, rank 0%0.2o, new TTL %d\n",
+ VERBOSE_MSG(qry, "=> wildcard: skipping %s, rank 0%.2o, new TTL %d\n",
eh->is_packet ? "packet" : "RR", eh->rank, new_ttl);
return ctx->state;
}
/* Check if the record is OK. */
int32_t new_ttl = get_new_ttl(eh, qry, k->zname, KNOT_RRTYPE_SOA);
if (new_ttl < 0 || eh->rank < lowest_rank || eh->is_packet) {
- VERBOSE_MSG(qry, "=> SOA unfit %s: rank 0%0.2o, new TTL %d\n",
+ VERBOSE_MSG(qry, "=> SOA unfit %s: rank 0%.2o, new TTL %d\n",
(eh->is_packet ? "packet" : "RR"),
eh->rank, new_ttl);
return ctx->state;
if (qry->flags.DNSSEC_INSECURE) {
qry->flags.DNSSEC_WANT = false;
}
- VERBOSE_MSG(qry, "=> satisfied by exact RR or CNAME: rank 0%0.2o, new TTL %d\n",
+ VERBOSE_MSG(qry, "=> satisfied by exact RR or CNAME: rank 0%.2o, new TTL %d\n",
eh->rank, new_ttl);
return kr_ok();
}
* LATER(optim.): It's unlikely that we find a negative one,
* so we might theoretically skip all the cache code. */
- VERBOSE_MSG(qry, "=> skipping exact %s: rank 0%0.2o (min. 0%0.2o), new TTL %d\n",
+ VERBOSE_MSG(qry, "=> skipping exact %s: rank 0%.2o (min. 0%.2o), new TTL %d\n",
eh->is_packet ? "packet" : "RR", eh->rank, lowest_rank, new_ttl);
return kr_error(ENOENT);
}
const char *packet_str =
eh->is_packet ? "packet" : "RR";
VERBOSE_MSG(qry, "=> skipping unfit %s %s: "
- "rank 0%0.2o, new TTL %d\n",
+ "rank 0%.2o, new TTL %d\n",
type_str, packet_str,
eh->rank, new_ttl);
}
WITH_VERBOSE(qry) {
auto_free char *type_str = kr_rrtype_text(pkt_type),
*owner_str = kr_dname_text(owner);
- VERBOSE_MSG(qry, "=> stashed packet: rank 0%0.2o, TTL %d, "
+ VERBOSE_MSG(qry, "=> stashed packet: rank 0%.2o, TTL %d, "
"%s %s (%d B)\n",
eh->rank, eh->ttl,
type_str, owner_str, (int)val_new_entry.len);
qry->flags.DNSSEC_WANT = false;
}
qry->flags.DNSSEC_OPTOUT = eh->has_optout;
- VERBOSE_MSG(qry, "=> satisfied by exact packet: rank 0%0.2o, new TTL %d\n",
+ VERBOSE_MSG(qry, "=> satisfied by exact packet: rank 0%.2o, new TTL %d\n",
eh->rank, new_ttl);
return kr_ok();
}
#define KR_PURE __attribute__((__pure__))
#define KR_NORETURN __attribute__((__noreturn__))
#define KR_COLD __attribute__((__cold__))
+#define KR_PRINTF(n) __attribute__((format (printf, n, (n+1))))
#else
#define KR_EXPORT
#define KR_CONST
#define KR_PURE
#define KR_NORETURN
#define KR_COLD
+#define KR_PRINTF(n)
#endif
#ifndef uint /* Redefining typedef is a C11 feature. */
char name_str[KNOT_DNAME_MAXLEN], type_str[16];
knot_dname_to_str(name_str, query->sname, sizeof(name_str));
knot_rrtype_to_string(query->stype, type_str, sizeof(type_str));
- QVERBOSE_MSG(query, "'%s' type '%s' id was assigned, parent id %hu\n",
+ QVERBOSE_MSG(query, "'%s' type '%s' id was assigned, parent id %u\n",
name_str, type_str, query->parent ? query->parent->id : 0);
}
return kr_ok();
KR_EXPORT bool kr_verbose_set(bool status);
/** Log a message if in --verbose mode. */
-KR_EXPORT void kr_log_verbose(const char *fmt, ...);
+KR_EXPORT KR_PRINTF(1)
+void kr_log_verbose(const char *fmt, ...);
/**
* @brief Return true if the query has request log handler installed.
* @param fmt message format
* @return true if the message was logged
*/
-KR_EXPORT bool kr_log_trace(const struct kr_query *query, const char *source, const char *fmt, ...);
+KR_EXPORT KR_PRINTF(3)
+bool kr_log_trace(const struct kr_query *query, const char *source, const char *fmt, ...);
#ifdef NOVERBOSELOG
/* Efficient compile-time disabling of verbose messages. */
}
/** Printf onto the lua stack, avoiding additional copy (thin wrapper). */
+KR_PRINTF(2)
static inline const char *lua_push_printf(lua_State *L, const char *fmt, ...)
{
va_list args;