Replace isc_log_create/destroy with isc_logconfig_get()
Add isc_logconfig_get() function to get the current logconfig and use
the getter to replace most of the little dancing around setting up
logging in the tools. Thus:
isc_log_create(mctx, &lctx, &logconfig);
isc_log_setcontext(lctx);
dns_log_setcontext(lctx);
...
...use lcfg...
...
isc_log_destroy();
is now only:
logconfig = isc_logconfig_get(lctx);
...use lcfg...
For thread-safety, isc_logconfig_get() should be surrounded by RCU read
lock, but since we never use isc_logconfig_get() in threaded context,
the only place where it is actually used (but not really needed) is
named_log_init().
This commit is contained in:
@@ -60,13 +60,3 @@ ns_log_init(isc_log_t *lctx);
|
||||
*\li The categories and modules defined above are available for
|
||||
* use by isc_log_usechannnel() and isc_log_write().
|
||||
*/
|
||||
|
||||
void
|
||||
ns_log_setcontext(isc_log_t *lctx);
|
||||
/*%<
|
||||
* Make the libns library use the provided context for logging internal
|
||||
* messages.
|
||||
*
|
||||
* Requires:
|
||||
*\li lctx is a valid logging context.
|
||||
*/
|
||||
|
||||
@@ -50,13 +50,6 @@ isc_log_t *ns_lctx = NULL;
|
||||
|
||||
void
|
||||
ns_log_init(isc_log_t *lctx) {
|
||||
REQUIRE(lctx != NULL);
|
||||
|
||||
isc_log_registercategories(lctx, ns_categories);
|
||||
isc_log_registermodules(lctx, ns_modules);
|
||||
}
|
||||
|
||||
void
|
||||
ns_log_setcontext(isc_log_t *lctx) {
|
||||
ns_lctx = lctx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user