1 /*
2 * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 * PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 /*! \file */
18
19 /* Principal Authors: DCL */
20
21 #include <isc/util.h>
22
23 #include <dns/log.h>
24
25 /*%
26 * When adding a new category, be sure to add the appropriate
27 * \#define to <dns/log.h>.
28 */
29 isc_logcategory_t dns_categories[] = {
30 { "notify", 0 },
31 { "database", 0 },
32 { "security", 0 },
33 { "_placeholder", 0 },
34 { "dnssec", 0 },
35 { "resolver", 0 },
36 { "xfer-in", 0 },
37 { "xfer-out", 0 },
38 { "dispatch", 0 },
39 { "lame-servers", 0 },
40 { "delegation-only", 0 },
41 { "edns-disabled", 0 },
42 { "rpz", 0 },
43 { "rate-limit", 0 },
44 { "cname", 0 },
45 { "spill", 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 isc_logmodule_t dns_modules[] = {
54 { "dns/db", 0 },
55 { "dns/rbtdb", 0 },
56 { "dns/rbtdb64", 0 },
57 { "dns/rbt", 0 },
58 { "dns/rdata", 0 },
59 { "dns/master", 0 },
60 { "dns/message", 0 },
61 { "dns/cache", 0 },
62 { "dns/config", 0 },
63 { "dns/resolver", 0 },
64 { "dns/zone", 0 },
65 { "dns/journal", 0 },
66 { "dns/adb", 0 },
67 { "dns/xfrin", 0 },
68 { "dns/xfrout", 0 },
69 { "dns/acl", 0 },
70 { "dns/validator", 0 },
71 { "dns/dispatch", 0 },
72 { "dns/request", 0 },
73 { "dns/masterdump", 0 },
74 { "dns/tsig", 0 },
75 { "dns/tkey", 0 },
76 { "dns/sdb", 0 },
77 { "dns/diff", 0 },
78 { "dns/hints", 0 },
79 { "dns/acache", 0 },
80 { "dns/dlz", 0 },
81 { "dns/dnssec", 0 },
82 { "dns/crypto", 0 },
83 { "dns/packets", 0 },
84 { "dns/ssu", 0 },
85 { NULL, 0 }
86 };
87
88 isc_log_t *dns_lctx = NULL;
89
90 void
dns_log_init(isc_log_t * lctx)91 dns_log_init(isc_log_t *lctx) {
92 REQUIRE(lctx != NULL);
93
94 isc_log_registercategories(lctx, dns_categories);
95 isc_log_registermodules(lctx, dns_modules);
96 }
97
98 void
dns_log_setcontext(isc_log_t * lctx)99 dns_log_setcontext(isc_log_t *lctx) {
100 dns_lctx = lctx;
101 }
102