xref: /netbsd-src/external/mpl/bind/dist/lib/dns/log.c (revision 82d56013d7b633d116a93943de88e08335357a7c)
1 /*	$NetBSD: log.c,v 1.5 2021/02/19 16:42:16 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 https://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 <isc/util.h>
17 
18 #include <dns/log.h>
19 
20 /*%
21  * When adding a new category, be sure to add the appropriate
22  * \#define to <dns/log.h>.
23  */
24 LIBDNS_EXTERNAL_DATA isc_logcategory_t dns_categories[] = {
25 	{ "notify", 0 },
26 	{ "database", 0 },
27 	{ "security", 0 },
28 	{ "_placeholder", 0 },
29 	{ "dnssec", 0 },
30 	{ "resolver", 0 },
31 	{ "xfer-in", 0 },
32 	{ "xfer-out", 0 },
33 	{ "dispatch", 0 },
34 	{ "lame-servers", 0 },
35 	{ "delegation-only", 0 },
36 	{ "edns-disabled", 0 },
37 	{ "rpz", 0 },
38 	{ "rate-limit", 0 },
39 	{ "cname", 0 },
40 	{ "spill", 0 },
41 	{ "dnstap", 0 },
42 	{ "zoneload", 0 },
43 	{ "nsid", 0 },
44 	{ NULL, 0 }
45 };
46 
47 /*%
48  * When adding a new module, be sure to add the appropriate
49  * \#define to <dns/log.h>.
50  */
51 LIBDNS_EXTERNAL_DATA isc_logmodule_t dns_modules[] = {
52 	{ "dns/db", 0 },	 { "dns/rbtdb", 0 },
53 	{ "dns/rbt", 0 },	 { "dns/rdata", 0 },
54 	{ "dns/master", 0 },	 { "dns/message", 0 },
55 	{ "dns/cache", 0 },	 { "dns/config", 0 },
56 	{ "dns/resolver", 0 },	 { "dns/zone", 0 },
57 	{ "dns/journal", 0 },	 { "dns/adb", 0 },
58 	{ "dns/xfrin", 0 },	 { "dns/xfrout", 0 },
59 	{ "dns/acl", 0 },	 { "dns/validator", 0 },
60 	{ "dns/dispatch", 0 },	 { "dns/request", 0 },
61 	{ "dns/masterdump", 0 }, { "dns/tsig", 0 },
62 	{ "dns/tkey", 0 },	 { "dns/sdb", 0 },
63 	{ "dns/diff", 0 },	 { "dns/hints", 0 },
64 	{ "dns/unused1", 0 },	 { "dns/dlz", 0 },
65 	{ "dns/dnssec", 0 },	 { "dns/crypto", 0 },
66 	{ "dns/packets", 0 },	 { "dns/nta", 0 },
67 	{ "dns/dyndb", 0 },	 { "dns/dnstap", 0 },
68 	{ "dns/ssu", 0 },	 { NULL, 0 }
69 };
70 
71 LIBDNS_EXTERNAL_DATA isc_log_t *dns_lctx = NULL;
72 
73 void
74 dns_log_init(isc_log_t *lctx) {
75 	REQUIRE(lctx != NULL);
76 
77 	isc_log_registercategories(lctx, dns_categories);
78 	isc_log_registermodules(lctx, dns_modules);
79 }
80 
81 void
82 dns_log_setcontext(isc_log_t *lctx) {
83 	dns_lctx = lctx;
84 }
85