From 0f40f8bb9a78789f8c6e90bb41afe3949a3d9251 Mon Sep 17 00:00:00 2001
From: Tomas Krizek <tomas.krizek@nic.cz>
Date: Tue, 9 Nov 2021 16:06:25 +0100
Subject: [PATCH] logging: remove QVERBOSE in favor of kr_log_q

---
 daemon/worker.c                 | 2 +-
 daemon/zimport.c                | 2 +-
 lib/cache/impl.h                | 2 +-
 lib/dnssec.c                    | 2 +-
 lib/layer.h                     | 2 --
 lib/layer/iterate.c             | 4 ++--
 lib/layer/validate.c            | 2 +-
 lib/resolve.c                   | 2 +-
 lib/rplan.c                     | 2 +-
 lib/selection.c                 | 2 +-
 lib/selection_forward.c         | 2 +-
 lib/selection_iter.c            | 2 +-
 lib/utils.c                     | 2 +-
 lib/zonecut.c                   | 2 +-
 modules/cookies/cookiemonster.c | 2 +-
 modules/hints/hints.c           | 2 +-
 modules/stats/stats.c           | 2 +-
 17 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/daemon/worker.c b/daemon/worker.c
index c8bceffd1..ed79788d4 100644
--- a/daemon/worker.c
+++ b/daemon/worker.c
@@ -51,7 +51,7 @@
 #define MAX_PIPELINED 100
 #endif
 
-#define VERBOSE_MSG(qry, ...) QRVERBOSE(qry, WORKER, __VA_ARGS__)
+#define VERBOSE_MSG(qry, ...) kr_log_q(qry, WORKER, __VA_ARGS__)
 
 /** Client request state. */
 struct request_ctx
diff --git a/daemon/zimport.c b/daemon/zimport.c
index df25ae17e..a07b59c76 100644
--- a/daemon/zimport.c
+++ b/daemon/zimport.c
@@ -47,7 +47,7 @@
 #include "lib/generic/map.h"
 #include "lib/generic/array.h"
 
-#define VERBOSE_MSG(qry, ...) QRVERBOSE(qry, ZIMPORT, __VA_ARGS__)
+#define VERBOSE_MSG(qry, ...) kr_log_q(qry, ZIMPORT, __VA_ARGS__)
 
 /* Pause between parse and import stages, milliseconds.
  * See comment in zi_zone_import() */
diff --git a/lib/cache/impl.h b/lib/cache/impl.h
index 7887341d4..a670281e3 100644
--- a/lib/cache/impl.h
+++ b/lib/cache/impl.h
@@ -417,7 +417,7 @@ int nsec3_src_synth(struct key *k, struct answer *ans, const knot_dname_t *clenc
 
 
 
-#define VERBOSE_MSG(qry, ...) QRVERBOSE((qry), CACHE,  ## __VA_ARGS__)
+#define VERBOSE_MSG(qry, ...) kr_log_q((qry), CACHE,  ## __VA_ARGS__)
 #define WITH_VERBOSE(qry) if (kr_log_is_debug_qry(CACHE, (qry)))
 
 /** Shorthand for operations on cache backend */
diff --git a/lib/dnssec.c b/lib/dnssec.c
index 43ba20161..2c5d19763 100644
--- a/lib/dnssec.c
+++ b/lib/dnssec.c
@@ -153,7 +153,7 @@ static bool trim_ttl(knot_rrset_t *rrs, const knot_rdata_t *sig,
 	if (kr_log_is_debug_qry(VALIDATOR, log_qry)) {
 		auto_free char *name_str = kr_dname_text(rrs->owner),
 				*type_str = kr_rrtype_text(rrs->type);
-		QRVERBOSE(log_qry, VALIDATOR, "trimming TTL of %s %s: %d -> %d\n",
+		kr_log_q(log_qry, VALIDATOR, "trimming TTL of %s %s: %d -> %d\n",
 			name_str, type_str, (int)rrs->ttl, (int)ttl_max);
 	}
 	rrs->ttl = ttl_max;
diff --git a/lib/layer.h b/lib/layer.h
index 0d228c81b..1e7d112c9 100644
--- a/lib/layer.h
+++ b/lib/layer.h
@@ -8,8 +8,6 @@
 #include "lib/defines.h"
 #include "lib/utils.h"
 
-#define QRVERBOSE kr_log_q // TODO: perhaps eliminate
-
 /** Layer processing states.  Only one value at a time (but see TODO).
  *
  *  Each state represents the state machine transition,
diff --git a/lib/layer/iterate.c b/lib/layer/iterate.c
index 34113218d..7806d996e 100644
--- a/lib/layer/iterate.c
+++ b/lib/layer/iterate.c
@@ -32,8 +32,8 @@
 #include "lib/module.h"
 #include "lib/dnssec/ta.h"
 
-#define VERBOSE_MSG(...) QRVERBOSE(req->current_query, ITERATOR, __VA_ARGS__)
-#define QVERBOSE_MSG(qry, ...) QRVERBOSE(qry, ITERATOR, __VA_ARGS__)
+#define VERBOSE_MSG(...) kr_log_q(req->current_query, ITERATOR, __VA_ARGS__)
+#define QVERBOSE_MSG(qry, ...) kr_log_q(qry, ITERATOR, __VA_ARGS__)
 #define WITH_VERBOSE(qry) if (kr_log_is_debug_qry(ITERATOR, (qry)))
 
 /* Iterator often walks through packet section, this is an abstraction. */
diff --git a/lib/layer/validate.c b/lib/layer/validate.c
index bdb2368f0..aa1715e1b 100644
--- a/lib/layer/validate.c
+++ b/lib/layer/validate.c
@@ -25,7 +25,7 @@
 #include "lib/module.h"
 #include "lib/selection.h"
 
-#define VERBOSE_MSG(qry, ...) QRVERBOSE(qry, VALIDATOR, __VA_ARGS__)
+#define VERBOSE_MSG(qry, ...) kr_log_q(qry, VALIDATOR, __VA_ARGS__)
 
 #define MAX_REVALIDATION_CNT 2
 
diff --git a/lib/resolve.c b/lib/resolve.c
index 12cb14a16..8897afa26 100644
--- a/lib/resolve.c
+++ b/lib/resolve.c
@@ -26,7 +26,7 @@
 #define KNOT_EDNS_OPTION_COOKIE 10
 #endif /* ENABLE_COOKIES */
 
-#define VERBOSE_MSG(qry, ...) QRVERBOSE((qry), RESOLVER,  __VA_ARGS__)
+#define VERBOSE_MSG(qry, ...) kr_log_q((qry), RESOLVER,  __VA_ARGS__)
 
 bool kr_rank_check(uint8_t rank)
 {
diff --git a/lib/rplan.c b/lib/rplan.c
index 5f5904bad..3df5e1bd9 100644
--- a/lib/rplan.c
+++ b/lib/rplan.c
@@ -11,7 +11,7 @@
 #include "lib/defines.h"
 #include "lib/layer.h"
 
-#define VERBOSE_MSG(qry, ...) QRVERBOSE(qry, PLAN,  __VA_ARGS__)
+#define VERBOSE_MSG(qry, ...) kr_log_q(qry, PLAN,  __VA_ARGS__)
 
 inline static unsigned char chars_or(const unsigned char a, const unsigned char b)
 {
diff --git a/lib/selection.c b/lib/selection.c
index 8e737fc93..a26c42da5 100644
--- a/lib/selection.c
+++ b/lib/selection.c
@@ -14,7 +14,7 @@
 
 #include "lib/utils.h"
 
-#define VERBOSE_MSG(qry, ...) QRVERBOSE((qry), SELECTION, __VA_ARGS__)
+#define VERBOSE_MSG(qry, ...) kr_log_q((qry), SELECTION, __VA_ARGS__)
 
 #define DEFAULT_TIMEOUT 400
 #define MAX_TIMEOUT 10000
diff --git a/lib/selection_forward.c b/lib/selection_forward.c
index 0a97da929..baab3abd5 100644
--- a/lib/selection_forward.c
+++ b/lib/selection_forward.c
@@ -5,7 +5,7 @@
 #include "lib/selection_forward.h"
 #include "lib/resolve.h"
 
-#define VERBOSE_MSG(qry, ...) QRVERBOSE((qry), SELECTION, __VA_ARGS__)
+#define VERBOSE_MSG(qry, ...) kr_log_q((qry), SELECTION, __VA_ARGS__)
 
 #define FORWARDING_TIMEOUT 2000
 
diff --git a/lib/selection_iter.c b/lib/selection_iter.c
index 2e70265be..eff4c0b9c 100644
--- a/lib/selection_iter.c
+++ b/lib/selection_iter.c
@@ -10,7 +10,7 @@
 #include "lib/zonecut.h"
 #include "lib/resolve.h"
 
-#define VERBOSE_MSG(qry, ...) QRVERBOSE((qry), SELECTION, __VA_ARGS__)
+#define VERBOSE_MSG(qry, ...) kr_log_q((qry), SELECTION, __VA_ARGS__)
 
 /// To be held per query and locally.  Allocations are in the kr_request's mempool.
 struct iter_local_state {
diff --git a/lib/utils.c b/lib/utils.c
index efc1e5bcd..4b6ff5589 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -770,7 +770,7 @@ int kr_ranked_rrarray_finalize(ranked_rr_array_t *array, uint32_t qry_uid, knot_
 				if (knot_rdata_cmp(ra->at[i], ra->at[i + 1]) == 0) {
 					ra->at[i] = NULL;
 					++dup_count;
-					QRVERBOSE(NULL, ITERATOR, "deleted duplicate RR\n");
+					kr_log_q(NULL, ITERATOR, "deleted duplicate RR\n");
 				}
 			}
 			/* Prepare rdataset, except rdata contents. */
diff --git a/lib/zonecut.c b/lib/zonecut.c
index 9f0a86604..774789fca 100644
--- a/lib/zonecut.c
+++ b/lib/zonecut.c
@@ -15,7 +15,7 @@
 #include <libknot/packet/wire.h>
 #include <libknot/rrtype/rdname.h>
 
-#define VERBOSE_MSG(qry, ...) QRVERBOSE(qry, ZCUT, __VA_ARGS__)
+#define VERBOSE_MSG(qry, ...) kr_log_q(qry, ZCUT, __VA_ARGS__)
 
 /** Information for one NS name + address type. */
 typedef enum {
diff --git a/modules/cookies/cookiemonster.c b/modules/cookies/cookiemonster.c
index f118b7e75..af4655b44 100644
--- a/modules/cookies/cookiemonster.c
+++ b/modules/cookies/cookiemonster.c
@@ -20,7 +20,7 @@
 #include "lib/rplan.h"
 #include "modules/cookies/cookiemonster.h"
 
-#define VERBOSE_MSG(qry, ...) QRVERBOSE(qry, COOKIES, __VA_ARGS__)
+#define VERBOSE_MSG(qry, ...) kr_log_q(qry, COOKIES, __VA_ARGS__)
 
 /**
  * Obtain address from query/response context if if can be obtained.
diff --git a/modules/hints/hints.c b/modules/hints/hints.c
index 737b7683f..eb79a3d67 100644
--- a/modules/hints/hints.c
+++ b/modules/hints/hints.c
@@ -25,7 +25,7 @@
 #include <math.h>
 
 /* Defaults */
-#define VERBOSE_MSG(qry, ...) QRVERBOSE(qry, HINT,  __VA_ARGS__)
+#define VERBOSE_MSG(qry, ...) kr_log_q(qry, HINT,  __VA_ARGS__)
 #define ERR_MSG(...) kr_log_error(HINT, "[     ]" __VA_ARGS__)
 
 struct hints_data {
diff --git a/modules/stats/stats.c b/modules/stats/stats.c
index 3b69cd1f1..edb972e2e 100644
--- a/modules/stats/stats.c
+++ b/modules/stats/stats.c
@@ -25,7 +25,7 @@
 #include "lib/resolve.h"
 
 /* Defaults */
-#define VERBOSE_MSG(qry, ...) QRVERBOSE(qry, STATISTICS,  __VA_ARGS__)
+#define VERBOSE_MSG(qry, ...) kr_log_q(qry, STATISTICS,  __VA_ARGS__)
 #define FREQUENT_PSAMPLE  10 /* Sampling rate, 1 in N */
 #ifdef LRU_REP_SIZE
  #define FREQUENT_COUNT LRU_REP_SIZE /* Size of frequent tables */
-- 
GitLab