xref: /netbsd-src/external/mpl/bind/dist/lib/dns/log.c (revision bcda20f65a8566e103791ec395f7f499ef322704)
1 /*	$NetBSD: log.c,v 1.8 2025/01/26 16:25:23 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 },
28 	{ "security", 0 },	{ "_placeholder", 0 },
29 	{ "dnssec", 0 },	{ "resolver", 0 },
30 	{ "xfer-in", 0 },	{ "xfer-out", 0 },
31 	{ "dispatch", 0 },	{ "lame-servers", 0 },
32 	{ "edns-disabled", 0 }, { "rpz", 0 },
33 	{ "rate-limit", 0 },	{ "cname", 0 },
34 	{ "spill", 0 },		{ "dnstap", 0 },
35 	{ "zoneload", 0 },	{ "nsid", 0 },
36 	{ "rpz-passthru", 0 },	{ NULL, 0 }
37 };
38 
39 /*%
40  * When adding a new module, be sure to add the appropriate
41  * \#define to <dns/log.h>.
42  */
43 isc_logmodule_t dns_modules[] = {
44 	{ "dns/db", 0 },	 { "dns/rbtdb", 0 },	{ "dns/rbt", 0 },
45 	{ "dns/rdata", 0 },	 { "dns/master", 0 },	{ "dns/message", 0 },
46 	{ "dns/cache", 0 },	 { "dns/config", 0 },	{ "dns/resolver", 0 },
47 	{ "dns/zone", 0 },	 { "dns/journal", 0 },	{ "dns/adb", 0 },
48 	{ "dns/xfrin", 0 },	 { "dns/xfrout", 0 },	{ "dns/acl", 0 },
49 	{ "dns/validator", 0 },	 { "dns/dispatch", 0 }, { "dns/request", 0 },
50 	{ "dns/masterdump", 0 }, { "dns/tsig", 0 },	{ "dns/tkey", 0 },
51 	{ "dns/sdb", 0 },	 { "dns/diff", 0 },	{ "dns/hints", 0 },
52 	{ "dns/unused1", 0 },	 { "dns/dlz", 0 },	{ "dns/dnssec", 0 },
53 	{ "dns/crypto", 0 },	 { "dns/packets", 0 },	{ "dns/nta", 0 },
54 	{ "dns/dyndb", 0 },	 { "dns/dnstap", 0 },	{ "dns/ssu", 0 },
55 	{ "dns/qp", 0 },	 { NULL, 0 },
56 };
57 
58 isc_log_t *dns_lctx = NULL;
59 
60 void
61 dns_log_init(isc_log_t *lctx) {
62 	REQUIRE(lctx != NULL);
63 
64 	isc_log_registercategories(lctx, dns_categories);
65 	isc_log_registermodules(lctx, dns_modules);
66 }
67 
68 void
69 dns_log_setcontext(isc_log_t *lctx) {
70 	dns_lctx = lctx;
71 }
72