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

@@ -1132,17 +1132,17 @@ the following steps need to be taken to initialize it.
null, and all other messages to syslog.
result = isc_log_usechannel(lcfg, "default_stderr",
DNS_LOGCATEGORY_SECURITY, NULL);
DNS_LOGCATEGORY_SECURITY, ISC_LOGMODULE_DEFAULT);
if (result != ISC_R_SUCCESS)
oops_it_didnt_work();
result = isc_log_usechannel(lcfg, "null",
DNS_LOGCATEGORY_DATABASE, NULL);
DNS_LOGCATEGORY_DATABASE, ISC_LOGMODULE_DEFAULT);
if (result != ISC_R_SUCCESS)
oops_it_didnt_work();
result = isc_log_usechannel(lcfg, "default_syslog",
ISC_LOGCATEGORY_DEFAULT, NULL);
ISC_LOGCATEGORY_DEFAULT, ISC_LOGMODULE_DEFAULT);
if (result != ISC_R_SUCCESS)
oops_it_didnt_work();