xref: /minix/external/bsd/bind/dist/lib/dns/log.c (revision 00b67f09)
1 /*	$NetBSD: log.c,v 1.8 2015/07/08 17:28:58 christos Exp $	*/
2 
3 /*
4  * Copyright (C) 2004-2007, 2009, 2011-2014  Internet Systems Consortium, Inc. ("ISC")
5  * Copyright (C) 1999-2001, 2003  Internet Software Consortium.
6  *
7  * Permission to use, copy, modify, and/or distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /* Id: log.c,v 1.49 2011/10/13 22:48:24 tbox Exp  */
21 
22 /*! \file */
23 
24 /* Principal Authors: DCL */
25 
26 #include <config.h>
27 
28 #include <isc/util.h>
29 
30 #include <dns/log.h>
31 
32 /*%
33  * When adding a new category, be sure to add the appropriate
34  * \#define to <dns/log.h>.
35  */
36 LIBDNS_EXTERNAL_DATA isc_logcategory_t dns_categories[] = {
37 	{ "notify", 	0 },
38 	{ "database", 	0 },
39 	{ "security", 	0 },
40 	{ "_placeholder", 0 },
41 	{ "dnssec",	0 },
42 	{ "resolver",	0 },
43 	{ "xfer-in",	0 },
44 	{ "xfer-out",	0 },
45 	{ "dispatch",	0 },
46 	{ "lame-servers", 0 },
47 	{ "delegation-only", 0 },
48 	{ "edns-disabled", 0 },
49 	{ "rpz",	0 },
50 	{ "rate-limit",	0 },
51 	{ "cname",	0 },
52 	{ NULL, 	0 }
53 };
54 
55 /*%
56  * When adding a new module, be sure to add the appropriate
57  * \#define to <dns/log.h>.
58  */
59 LIBDNS_EXTERNAL_DATA isc_logmodule_t dns_modules[] = {
60 	{ "dns/db",	 	0 },
61 	{ "dns/rbtdb", 		0 },
62 	{ "dns/rbtdb64", 	0 },
63 	{ "dns/rbt", 		0 },
64 	{ "dns/rdata", 		0 },
65 	{ "dns/master", 	0 },
66 	{ "dns/message", 	0 },
67 	{ "dns/cache", 		0 },
68 	{ "dns/config",		0 },
69 	{ "dns/resolver",	0 },
70 	{ "dns/zone",		0 },
71 	{ "dns/journal",	0 },
72 	{ "dns/adb",		0 },
73 	{ "dns/xfrin",		0 },
74 	{ "dns/xfrout",		0 },
75 	{ "dns/acl",		0 },
76 	{ "dns/validator",	0 },
77 	{ "dns/dispatch",	0 },
78 	{ "dns/request",	0 },
79 	{ "dns/masterdump",	0 },
80 	{ "dns/tsig",		0 },
81 	{ "dns/tkey",		0 },
82 	{ "dns/sdb",		0 },
83 	{ "dns/diff",		0 },
84 	{ "dns/hints",		0 },
85 	{ "dns/acache",		0 },
86 	{ "dns/dlz",		0 },
87 	{ "dns/dnssec",		0 },
88 	{ "dns/crypto",		0 },
89 	{ "dns/packets",	0 },
90 	{ NULL, 		0 }
91 };
92 
93 LIBDNS_EXTERNAL_DATA isc_log_t *dns_lctx = NULL;
94 
95 void
dns_log_init(isc_log_t * lctx)96 dns_log_init(isc_log_t *lctx) {
97 	REQUIRE(lctx != NULL);
98 
99 	isc_log_registercategories(lctx, dns_categories);
100 	isc_log_registermodules(lctx, dns_modules);
101 }
102 
103 void
dns_log_setcontext(isc_log_t * lctx)104 dns_log_setcontext(isc_log_t *lctx) {
105 	dns_lctx = lctx;
106 }
107