xref: /netbsd-src/external/mpl/bind/dist/lib/dns/log.c (revision e6c7e151de239c49d2e38720a061ed9d1fa99309)
1 /*	$NetBSD: log.c,v 1.3 2019/01/09 16:55:11 christos Exp $	*/
2 
3 /*
4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9  *
10  * See the COPYRIGHT file distributed with this work for additional
11  * information regarding copyright ownership.
12  */
13 
14 /*! \file */
15 
16 #include <config.h>
17 
18 #include <isc/util.h>
19 
20 #include <dns/log.h>
21 
22 /*%
23  * When adding a new category, be sure to add the appropriate
24  * \#define to <dns/log.h>.
25  */
26 LIBDNS_EXTERNAL_DATA isc_logcategory_t dns_categories[] = {
27 	{ "notify", 	0 },
28 	{ "database", 	0 },
29 	{ "security", 	0 },
30 	{ "_placeholder", 0 },
31 	{ "dnssec",	0 },
32 	{ "resolver",	0 },
33 	{ "xfer-in",	0 },
34 	{ "xfer-out",	0 },
35 	{ "dispatch",	0 },
36 	{ "lame-servers", 0 },
37 	{ "delegation-only", 0 },
38 	{ "edns-disabled", 0 },
39 	{ "rpz",	0 },
40 	{ "rate-limit",	0 },
41 	{ "cname",	0 },
42 	{ "spill",	0 },
43 	{ "dnstap",	0 },
44 	{ "zoneload",	0 },
45 	{ "nsid",	0 },
46 	{ NULL, 	0 }
47 };
48 
49 /*%
50  * When adding a new module, be sure to add the appropriate
51  * \#define to <dns/log.h>.
52  */
53 LIBDNS_EXTERNAL_DATA isc_logmodule_t dns_modules[] = {
54 	{ "dns/db",	 	0 },
55 	{ "dns/rbtdb", 		0 },
56 	{ "dns/rbt", 		0 },
57 	{ "dns/rdata", 		0 },
58 	{ "dns/master", 	0 },
59 	{ "dns/message", 	0 },
60 	{ "dns/cache", 		0 },
61 	{ "dns/config",		0 },
62 	{ "dns/resolver",	0 },
63 	{ "dns/zone",		0 },
64 	{ "dns/journal",	0 },
65 	{ "dns/adb",		0 },
66 	{ "dns/xfrin",		0 },
67 	{ "dns/xfrout",		0 },
68 	{ "dns/acl",		0 },
69 	{ "dns/validator",	0 },
70 	{ "dns/dispatch",	0 },
71 	{ "dns/request",	0 },
72 	{ "dns/masterdump",	0 },
73 	{ "dns/tsig",		0 },
74 	{ "dns/tkey",		0 },
75 	{ "dns/sdb",		0 },
76 	{ "dns/diff",		0 },
77 	{ "dns/hints",		0 },
78 	{ "dns/unused1",	0 },
79 	{ "dns/dlz",		0 },
80 	{ "dns/dnssec",		0 },
81 	{ "dns/crypto",		0 },
82 	{ "dns/packets",	0 },
83 	{ "dns/nta",		0 },
84 	{ "dns/dyndb",		0 },
85 	{ "dns/dnstap",		0 },
86 	{ "dns/ssu",		0 },
87 	{ NULL, 		0 }
88 };
89 
90 LIBDNS_EXTERNAL_DATA isc_log_t *dns_lctx = NULL;
91 
92 void
93 dns_log_init(isc_log_t *lctx) {
94 	REQUIRE(lctx != NULL);
95 
96 	isc_log_registercategories(lctx, dns_categories);
97 	isc_log_registermodules(lctx, dns_modules);
98 }
99 
100 void
101 dns_log_setcontext(isc_log_t *lctx) {
102 	dns_lctx = lctx;
103 }
104