From e24349aa2743d7bc0bc6efc34ee2b61de0f09e1e Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Thu, 22 Feb 2001 02:39:24 +0000 Subject: [PATCH] added isccfg log modules and categories --- lib/isccfg/Makefile.in | 6 ++-- lib/isccfg/include/isccfg/log.h | 53 +++++++++++++++++++++++++++++++++ lib/isccfg/log.c | 50 +++++++++++++++++++++++++++++++ lib/isccfg/parser.c | 10 +++---- util/copyrights | 2 ++ 5 files changed, 113 insertions(+), 8 deletions(-) create mode 100644 lib/isccfg/include/isccfg/log.h create mode 100644 lib/isccfg/log.c diff --git a/lib/isccfg/Makefile.in b/lib/isccfg/Makefile.in index 4a113029ec..b7f9fe2838 100644 --- a/lib/isccfg/Makefile.in +++ b/lib/isccfg/Makefile.in @@ -13,7 +13,7 @@ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.1 2001/02/15 04:14:12 gson Exp $ +# $Id: Makefile.in,v 1.2 2001/02/22 02:38:22 gson Exp $ srcdir = @srcdir@ VPATH = @srcdir@ @@ -41,10 +41,10 @@ LIBS = @LIBS@ SUBDIRS = include # Alphabetically -OBJS = parser.@O@ +OBJS = parser.@O@ log.@O@ # Alphabetically -SRCS = parser.c +SRCS = parser.c log.c TARGETS = timestamp diff --git a/lib/isccfg/include/isccfg/log.h b/lib/isccfg/include/isccfg/log.h new file mode 100644 index 0000000000..93ada406fa --- /dev/null +++ b/lib/isccfg/include/isccfg/log.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2001 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM + * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL + * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: log.h,v 1.1 2001/02/22 02:38:25 gson Exp $ */ + +#ifndef ISCCFG_LOG_H +#define ISCCFG_LOG_H 1 + +#include +#include + +extern isc_logcategory_t isccfg_categories[]; +extern isc_logmodule_t isccfg_modules[]; + +#define ISCCFG_LOGCATEGORY_CONFIG (&isccfg_categories[0]) + +#define ISCCFG_LOGMODULE_PARSER (&isccfg_modules[0]) + +ISC_LANG_BEGINDECLS + +void +isccfg_log_init(isc_log_t *lctx); +/* + * Make the libisccfg categories and modules available for use with the + * ISC logging library. + * + * Requires: + * lctx is a valid logging context. + * + * isccfg_log_init() is called only once. + * + * Ensures: + * The catgories and modules defined above are available for + * use by isc_log_usechannnel() and isc_log_write(). + */ + +ISC_LANG_ENDDECLS + +#endif /* DNS_LOG_H */ diff --git a/lib/isccfg/log.c b/lib/isccfg/log.c new file mode 100644 index 0000000000..fc53c6ade9 --- /dev/null +++ b/lib/isccfg/log.c @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2001 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM + * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL + * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: log.c,v 1.1 2001/02/22 02:38:23 gson Exp $ */ + +#include + +#include + +#include + +/* + * When adding a new category, be sure to add the appropriate + * #define to . + */ +isc_logcategory_t isccfg_categories[] = { + { "config", 0 }, + { NULL, 0 } +}; + +/* + * When adding a new module, be sure to add the appropriate + * #define to . + */ +isc_logmodule_t isccfg_modules[] = { + { "isccfg/parser", 0 }, + { NULL, 0 } +}; + +void +isccfg_log_init(isc_log_t *lctx) { + REQUIRE(lctx != NULL); + + isc_log_registercategories(lctx, isccfg_categories); + isc_log_registermodules(lctx, isccfg_modules); +} diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 0638fdcd2d..ce1ddb60d3 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: parser.c,v 1.13 2001/02/22 01:40:51 bwelling Exp $ */ +/* $Id: parser.c,v 1.14 2001/02/22 02:38:23 gson Exp $ */ #include @@ -33,11 +33,11 @@ #include #include +#include -/* XXX create a file and a corresponding .c file */ - -#define CAT ISC_LOGCATEGORY_GENERAL -#define MOD ISC_LOGMODULE_SOCKET /* XXX */ +/* Shorthand */ +#define CAT ISCCFG_LOGCATEGORY_CONFIG +#define MOD ISCCFG_LOGMODULE_PARSER /* * Pass one of these flags to parser_error() to include the diff --git a/util/copyrights b/util/copyrights index d0b16c3338..9cb72577c2 100644 --- a/util/copyrights +++ b/util/copyrights @@ -1319,12 +1319,14 @@ ./lib/isccfg/.cvsignore X 2001 ./lib/isccfg/Makefile.in C 2001 ./lib/isccfg/api C 2001 +./lib/isccfg/log.c C 2001 ./lib/isccfg/parser.c C 2000,2001 ./lib/isccfg/include/.cvsignore C 2001 ./lib/isccfg/include/Makefile.in C 2001 ./lib/isccfg/include/isccfg/.cvsignore C 2001 ./lib/isccfg/include/isccfg/Makefile.in C 2001 ./lib/isccfg/include/isccfg/cfg.h C 2000,2001 +./lib/isccfg/include/isccfg/log.h C 2001 ./lib/lwres/.cvsignore X 2000,2001 ./lib/lwres/Makefile.in MAKE 2000,2001 ./lib/lwres/api X 2000,2001