From d409ceeda41a256e8114423674d844d5f5035ee8 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Fri, 22 Oct 1999 19:30:38 +0000 Subject: [PATCH] do not require ': ' in module/category names --- lib/isc/include/isc/log.h | 14 ++------------ lib/isc/log.c | 23 ++++++++++++++++++----- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/lib/isc/include/isc/log.h b/lib/isc/include/isc/log.h index 724806242b..5a26bcc1ea 100644 --- a/lib/isc/include/isc/log.h +++ b/lib/isc/include/isc/log.h @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: log.h,v 1.3 1999/10/11 14:12:31 tale Exp $ */ +/* $Id: log.h,v 1.4 1999/10/22 19:30:38 halley Exp $ */ #ifndef ISC_LOG_H #define ISC_LOG_H 1 @@ -78,9 +78,7 @@ typedef struct isc_log isc_log_t; /* * Used to name the categories used by a library. An array of isc_logcategory * structures names each category, and the id value is initialized by calling - * isc_log_registercategories. Each name should end in a colon-space pair - * (": ") because it is used directly in the format string when - * ISC_LOG_PRINTCATEGORY is enabled for a channel. + * isc_log_registercategories. */ typedef struct isc_logcategory { const char *name; @@ -195,10 +193,6 @@ isc_log_registercategories(isc_log_t *lctx, isc_logcategory_t categories[]); * Notes: * The end of the categories array is identified by a NULL name. * - * The name within each structure of categories[] should end in a - * colon-space (": ") pair because its value is used to format the - * log message when ISC_LOG_PRINTCATEGORY is set for a channel. - * * Because the name is used by ISC_LOG_PRINTCATEGORY, it should not * be altered or destroyed after isc_log_registercategories(). * @@ -238,10 +232,6 @@ isc_log_registermodules(isc_log_t *lctx, isc_logmodule_t modules[]); * Notes: * The end of the modules array is identified by a NULL name. * - * The name within each structure of modules[] should end in a - * colon-space (": ") pair because its value is used to format the - * log message when ISC_LOG_PRINTMODULE is set for a channel. - * * Because the name is used by ISC_LOG_PRINTMODULE, it should not * be altered or destroyed after isc_log_registermodules(). * diff --git a/lib/isc/log.c b/lib/isc/log.c index f3e2f58497..32a378c1eb 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: log.c,v 1.7 1999/10/15 19:04:38 brister Exp $ */ +/* $Id: log.c,v 1.8 1999/10/22 19:29:24 halley Exp $ */ /* Principal Authors: DCL */ @@ -127,7 +127,7 @@ static const int syslog_map[] = { * channellist in the log context, it must come first in isc_categories[]. */ isc_logcategory_t isc_categories[] = { - { "default: ", 0 }, /* "default" must come first. */ + { "default", 0 }, /* "default" must come first. */ { NULL, 0 } }; @@ -866,15 +866,22 @@ isc_log_vwrite(isc_log_t *lctx, isc_logcategory_t *category, /* FALLTHROUGH */ case ISC_LOG_TOFILEDESC: - fprintf(FILE_STREAM(channel), "%s%s%s%s%s\n", + fprintf(FILE_STREAM(channel), "%s%s%s%s%s%s%s%s\n", (channel->flags & ISC_LOG_PRINTTIME) ? time_string : "", (channel->flags & ISC_LOG_PRINTCATEGORY) ? category->name : "", + (channel->flags & ISC_LOG_PRINTCATEGORY) ? + ": " : "", (channel->flags & ISC_LOG_PRINTMODULE) ? - module->name : "", + (module != NULL ? module->name : "") + : "", + (channel->flags & ISC_LOG_PRINTMODULE) ? + ": " : "", (channel->flags & ISC_LOG_PRINTLEVEL) ? level_string : "", + (channel->flags & ISC_LOG_PRINTLEVEL) ? + ": " : "", lctx->buffer); fflush(FILE_STREAM(channel)); @@ -908,16 +915,22 @@ isc_log_vwrite(isc_log_t *lctx, isc_logcategory_t *category, syslog_level = syslog_map[-level]; syslog(FACILITY(channel) | syslog_level, - "%s%s%s%s%s", + "%s%s%s%s%s%s%s%s", (channel->flags & ISC_LOG_PRINTTIME) ? time_string : "", (channel->flags & ISC_LOG_PRINTCATEGORY) ? category->name : "", + (channel->flags & ISC_LOG_PRINTCATEGORY) ? + ": " : "", (channel->flags & ISC_LOG_PRINTMODULE) ? (module != NULL ? module->name : "") : "", + (channel->flags & ISC_LOG_PRINTMODULE) ? + ": " : "", (channel->flags & ISC_LOG_PRINTLEVEL) ? level_string : "", + (channel->flags & ISC_LOG_PRINTLEVEL) ? + ": " : "", lctx->buffer); break;