Commit ce9b448e authored by Jan Včelák's avatar Jan Včelák 🚀

query processing: migrate to new logging API

parent 4ce6f129
......@@ -303,9 +303,9 @@ static int axfr_answer_init(struct answer_data *data)
return KNOT_EOK;
}
/* AXFR-specific logging (internal, expects 'data' variable set). */
#define AXFRIN_LOG(severity, msg...) \
ANSWER_LOG(severity, adata, "Incoming AXFR", msg)
/* AXFR-specific logging (internal, expects 'adata' variable set). */
#define AXFRIN_LOG(priority, msg...) \
ANSWER_LOG(priority, adata, "Incoming AXFR", msg)
static int axfr_answer_finalize(struct answer_data *adata)
{
......@@ -331,7 +331,7 @@ static int axfr_answer_finalize(struct answer_data *adata)
zone_contents_serial(old_contents),
zone_contents_serial(proc->contents));
AXFRIN_LOG(LOG_INFO, "Finished in %.02fs (%u messages, %s%.*f %s).",
AXFRIN_LOG(LOG_INFO, "Finished in %.02fs (%u messages, %s%.*f %s)",
time_diff(&proc->tstamp, &now) / 1000.0,
proc->npkts, SIZE_PARAMS(proc->nbytes));
......
......@@ -35,11 +35,9 @@ const knot_process_module_t *process_answer_get_module(void);
#define NS_PROC_ANSWER_ID 2
/*! \brief Answer processsing logging base. */
#define ANSWER_LOG(severity, data, what, msg...) do {\
const char *zone_str = (data)->param->zone->conf->name; \
NS_PROC_LOG(severity, LOG_SERVER, (data)->param->remote, zone_str, \
what " of '%s' from '%s': ", msg); \
} while(0)
#define ANSWER_LOG(priority, data, operation, msg...) \
NS_PROC_LOG(priority, (data)->param->remote, (data)->param->zone->name, \
operation, msg);
/*!
* \brief Processing module parameters.
......
......@@ -36,19 +36,17 @@ const knot_process_module_t *process_query_get_module(void);
#define NS_PROC_QUERY_ID 1
/*! \brief Query processing logging common base. */
#define NS_PROC_LOG(severity, log_type, remote, zone_str, what, msg, ...) do { \
#define NS_PROC_LOG(priority, remote, zone_name, operation, msg, ...) do { \
char addr_str[SOCKADDR_STRLEN] = {0}; \
sockaddr_tostr(remote, addr_str, sizeof(addr_str)); \
log_msg(log_type, severity, what msg "\n", zone_str, addr_str, ##__VA_ARGS__); \
log_msg_zone(priority, zone_name, operation ", remote %s: " msg "\n", \
addr_str, ##__VA_ARGS__); \
} while (0)
/*! \brief Query logging common base. */
#define QUERY_LOG(severity, qdata, what, msg...) do {\
char *zone_str = knot_dname_to_str(knot_pkt_qname((qdata)->query)); \
NS_PROC_LOG(severity, LOG_SERVER, (qdata)->param->remote, zone_str, \
what " of '%s' with '%s': ", msg); \
free(zone_str); \
} while(0)
#define QUERY_LOG(priority, qdata, operation, msg...) \
NS_PROC_LOG(priority, (qdata)->param->remote, knot_pkt_qname((qdata)->query), \
operation, msg);
/* Query processing specific flags. */
enum process_query_flag {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment