mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Add isc_log_setcontext() to set the isc_lctx global (ala dns_lctx) and add module names for isc/socket
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: log.c,v 1.28 2000/04/28 17:29:25 explorer Exp $ */
|
||||
/* $Id: log.c,v 1.29 2000/05/03 21:09:33 explorer Exp $ */
|
||||
|
||||
/* Principal Authors: DCL */
|
||||
|
||||
@@ -153,7 +153,12 @@ struct isc_log {
|
||||
* Used when ISC_LOG_PRINTLEVEL is enabled for a channel.
|
||||
*/
|
||||
static const char *log_level_strings[] = {
|
||||
"debug", "info", "notice", "warning", "error", "critical"
|
||||
"debug",
|
||||
"info",
|
||||
"notice",
|
||||
"warning",
|
||||
"error",
|
||||
"critical"
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -161,7 +166,12 @@ static const char *log_level_strings[] = {
|
||||
* XXXDCL This will need modification for NT.
|
||||
*/
|
||||
static const int syslog_map[] = {
|
||||
LOG_DEBUG, LOG_INFO, LOG_NOTICE, LOG_WARNING, LOG_ERR, LOG_CRIT
|
||||
LOG_DEBUG,
|
||||
LOG_INFO,
|
||||
LOG_NOTICE,
|
||||
LOG_WARNING,
|
||||
LOG_ERR,
|
||||
LOG_CRIT
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -178,6 +188,14 @@ isc_logcategory_t isc_categories[] = {
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
* See above comment for categories, and apply it to modules.
|
||||
*/
|
||||
isc_logmodule_t isc_modules[] = {
|
||||
{ "socket", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
* This essentially constant structure must be filled in at run time,
|
||||
* because its channel member is pointed to a channel that is created
|
||||
@@ -185,6 +203,11 @@ isc_logcategory_t isc_categories[] = {
|
||||
*/
|
||||
static isc_logchannellist_t default_channel;
|
||||
|
||||
/*
|
||||
* libisc logs to this context.
|
||||
*/
|
||||
isc_log_t *isc_lctx = NULL;
|
||||
|
||||
/*
|
||||
* Forward declarations.
|
||||
*/
|
||||
@@ -255,6 +278,7 @@ isc_log_create(isc_mem_t *mctx, isc_log_t **lctxp, isc_logconfig_t **lcfgp) {
|
||||
lctx->magic = LCTX_MAGIC;
|
||||
|
||||
isc_log_registercategories(lctx, isc_categories);
|
||||
isc_log_registermodules(lctx, isc_modules);
|
||||
result = isc_logconfig_create(lctx, &lcfg);
|
||||
|
||||
} else
|
||||
@@ -786,6 +810,14 @@ isc_log_vwrite1(isc_log_t *lctx, isc_logcategory_t *category,
|
||||
isc_log_doit(lctx, category, module, level, ISC_TRUE, format, args);
|
||||
}
|
||||
|
||||
void
|
||||
isc_log_setcontext(isc_log_t *lctx)
|
||||
{
|
||||
REQUIRE(isc_lctx == NULL);
|
||||
|
||||
isc_lctx = lctx;
|
||||
}
|
||||
|
||||
void
|
||||
isc_log_setdebuglevel(isc_log_t *lctx, unsigned int level) {
|
||||
REQUIRE(VALID_CONTEXT(lctx));
|
||||
|
Reference in New Issue
Block a user