2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-05 00:55:24 +00:00

Add isc_log_createandusechannel() function to simplify usage

The new
isc_log_createandusechannel() function combines following calls:

    isc_log_createchannel()
    isc_log_usechannel()

calls into a single call that cannot fail and therefore can be used in
places where we know this cannot fail thus simplifying the error
handling.
This commit is contained in:
Ondřej Surý
2024-08-14 14:38:07 +02:00
parent 091d738c72
commit 679e90a57d
20 changed files with 210 additions and 338 deletions

View File

@@ -2596,7 +2596,7 @@ isc__netmgr_log(const isc_nm_t *netmgr, int level, const char *fmt, ...) {
vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap);
va_end(ap);
isc_log_write(ISC_LOGCATEGORY_DEFAULT, ISC_LOGMODULE_NETMGR, level,
isc_log_write(ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_NETMGR, level,
"netmgr %p: %s", netmgr, msgbuf);
}
@@ -2613,7 +2613,7 @@ isc__nmsocket_log(const isc_nmsocket_t *sock, int level, const char *fmt, ...) {
vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap);
va_end(ap);
isc_log_write(ISC_LOGCATEGORY_DEFAULT, ISC_LOGMODULE_NETMGR, level,
isc_log_write(ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_NETMGR, level,
"socket %p: %s", sock, msgbuf);
}
@@ -2673,7 +2673,7 @@ isc__nm_received_proxy_header_log(isc_nmhandle_t *handle,
real_peer_fmt, real_local_fmt, proto);
if (cmd == ISC_PROXY2_CMD_LOCAL) {
isc_log_write(ISC_LOGCATEGORY_DEFAULT, ISC_LOGMODULE_NETMGR,
isc_log_write(ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_NETMGR,
log_level, "%s: command: LOCAL (%s)", common_msg,
real_addresses_msg);
return;
@@ -2686,7 +2686,7 @@ isc__nm_received_proxy_header_log(isc_nmhandle_t *handle,
switch (socktype) {
case 0:
isc_log_write(ISC_LOGCATEGORY_DEFAULT,
isc_log_write(ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_NETMGR, log_level,
"%s: command: PROXY (unspecified address "
"and socket type, %s)",
@@ -2714,7 +2714,7 @@ isc__nm_received_proxy_header_log(isc_nmhandle_t *handle,
dst_addr_msg = dst_addr_fmt;
}
isc_log_write(ISC_LOGCATEGORY_DEFAULT, ISC_LOGMODULE_NETMGR,
isc_log_write(ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_NETMGR,
log_level,
"%s: command: PROXY, socket type: %s, source: "
"%s, destination: %s, TLVs: %s",