xref: /netbsd-src/external/mpl/bind/dist/lib/dns/log.c (revision 3117ece4fc4a4ca4489ba793710b60b0d26bab6c)
1 /*	$NetBSD: log.c,v 1.7 2024/02/21 22:52:06 christos Exp $	*/
2 
3 /*
4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5  *
6  * SPDX-License-Identifier: MPL-2.0
7  *
8  * This Source Code Form is subject to the terms of the Mozilla Public
9  * License, v. 2.0. If a copy of the MPL was not distributed with this
10  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
11  *
12  * See the COPYRIGHT file distributed with this work for additional
13  * information regarding copyright ownership.
14  */
15 
16 /*! \file */
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 isc_logcategory_t dns_categories[] = {
27 	{ "notify", 0 },       { "database", 0 },	 { "security", 0 },
28 	{ "_placeholder", 0 }, { "dnssec", 0 },		 { "resolver", 0 },
29 	{ "xfer-in", 0 },      { "xfer-out", 0 },	 { "dispatch", 0 },
30 	{ "lame-servers", 0 }, { "delegation-only", 0 }, { "edns-disabled", 0 },
31 	{ "rpz", 0 },	       { "rate-limit", 0 },	 { "cname", 0 },
32 	{ "spill", 0 },	       { "dnstap", 0 },		 { "zoneload", 0 },
33 	{ "nsid", 0 },	       { "rpz-passthru", 0 },	 { NULL, 0 }
34 };
35 
36 /*%
37  * When adding a new module, be sure to add the appropriate
38  * \#define to <dns/log.h>.
39  */
40 isc_logmodule_t dns_modules[] = {
41 	{ "dns/db", 0 },	 { "dns/rbtdb", 0 },
42 	{ "dns/rbt", 0 },	 { "dns/rdata", 0 },
43 	{ "dns/master", 0 },	 { "dns/message", 0 },
44 	{ "dns/cache", 0 },	 { "dns/config", 0 },
45 	{ "dns/resolver", 0 },	 { "dns/zone", 0 },
46 	{ "dns/journal", 0 },	 { "dns/adb", 0 },
47 	{ "dns/xfrin", 0 },	 { "dns/xfrout", 0 },
48 	{ "dns/acl", 0 },	 { "dns/validator", 0 },
49 	{ "dns/dispatch", 0 },	 { "dns/request", 0 },
50 	{ "dns/masterdump", 0 }, { "dns/tsig", 0 },
51 	{ "dns/tkey", 0 },	 { "dns/sdb", 0 },
52 	{ "dns/diff", 0 },	 { "dns/hints", 0 },
53 	{ "dns/unused1", 0 },	 { "dns/dlz", 0 },
54 	{ "dns/dnssec", 0 },	 { "dns/crypto", 0 },
55 	{ "dns/packets", 0 },	 { "dns/nta", 0 },
56 	{ "dns/dyndb", 0 },	 { "dns/dnstap", 0 },
57 	{ "dns/ssu", 0 },	 { NULL, 0 }
58 };
59 
60 isc_log_t *dns_lctx = NULL;
61 
62 void
63 dns_log_init(isc_log_t *lctx) {
64 	REQUIRE(lctx != NULL);
65 
66 	isc_log_registercategories(lctx, dns_categories);
67 	isc_log_registermodules(lctx, dns_modules);
68 }
69 
70 void
71 dns_log_setcontext(isc_log_t *lctx) {
72 	dns_lctx = lctx;
73 }
74