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