1 /* $NetBSD: log.c,v 1.6 2022/09/23 12:15:36 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/result.h>
19 #include <isc/util.h>
20
21 #include <ns/log.h>
22
23 #ifndef ISC_FACILITY
24 #define ISC_FACILITY LOG_DAEMON
25 #endif /* ifndef ISC_FACILITY */
26
27 /*%
28 * When adding a new category, be sure to add the appropriate
29 * \#define to <ns/log.h>
30 */
31 LIBNS_EXTERNAL_DATA isc_logcategory_t ns_categories[] = {
32 { "client", 0 },
33 { "network", 0 },
34 { "update", 0 },
35 { "queries", 0 },
36 { "update-security", 0 },
37 { "query-errors", 0 },
38 { "trust-anchor-telemetry", 0 },
39 { "serve-stale", 0 },
40 { NULL, 0 }
41 };
42
43 /*%
44 * When adding a new module, be sure to add the appropriate
45 * \#define to <ns/log.h>.
46 */
47 LIBNS_EXTERNAL_DATA isc_logmodule_t ns_modules[] = {
48 { "ns/client", 0 }, { "ns/query", 0 }, { "ns/interfacemgr", 0 },
49 { "ns/update", 0 }, { "ns/xfer-in", 0 }, { "ns/xfer-out", 0 },
50 { "ns/notify", 0 }, { "ns/hooks", 0 }, { NULL, 0 }
51 };
52
53 LIBNS_EXTERNAL_DATA isc_log_t *ns_lctx = NULL;
54
55 void
ns_log_init(isc_log_t * lctx)56 ns_log_init(isc_log_t *lctx) {
57 REQUIRE(lctx != NULL);
58
59 isc_log_registercategories(lctx, ns_categories);
60 isc_log_registermodules(lctx, ns_modules);
61 }
62
63 void
ns_log_setcontext(isc_log_t * lctx)64 ns_log_setcontext(isc_log_t *lctx) {
65 ns_lctx = lctx;
66 }
67