1 /* $NetBSD: log.c,v 1.1 2024/02/18 20:57:32 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 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 }, { "dns/rbtdb", 0 },
55 { "dns/rbt", 0 }, { "dns/rdata", 0 },
56 { "dns/master", 0 }, { "dns/message", 0 },
57 { "dns/cache", 0 }, { "dns/config", 0 },
58 { "dns/resolver", 0 }, { "dns/zone", 0 },
59 { "dns/journal", 0 }, { "dns/adb", 0 },
60 { "dns/xfrin", 0 }, { "dns/xfrout", 0 },
61 { "dns/acl", 0 }, { "dns/validator", 0 },
62 { "dns/dispatch", 0 }, { "dns/request", 0 },
63 { "dns/masterdump", 0 }, { "dns/tsig", 0 },
64 { "dns/tkey", 0 }, { "dns/sdb", 0 },
65 { "dns/diff", 0 }, { "dns/hints", 0 },
66 { "dns/unused1", 0 }, { "dns/dlz", 0 },
67 { "dns/dnssec", 0 }, { "dns/crypto", 0 },
68 { "dns/packets", 0 }, { "dns/nta", 0 },
69 { "dns/dyndb", 0 }, { "dns/dnstap", 0 },
70 { "dns/ssu", 0 }, { NULL, 0 }
71 };
72
73 LIBDNS_EXTERNAL_DATA isc_log_t *dns_lctx = NULL;
74
75 void
dns_log_init(isc_log_t * lctx)76 dns_log_init(isc_log_t *lctx) {
77 REQUIRE(lctx != NULL);
78
79 isc_log_registercategories(lctx, dns_categories);
80 isc_log_registermodules(lctx, dns_modules);
81 }
82
83 void
dns_log_setcontext(isc_log_t * lctx)84 dns_log_setcontext(isc_log_t *lctx) {
85 dns_lctx = lctx;
86 }
87