log.c revision 1.1
1/*	$NetBSD: log.c,v 1.1 2018/08/12 12:08:07 christos Exp $	*/
2
3/*
4 * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 *
10 * See the COPYRIGHT file distributed with this work for additional
11 * information regarding copyright ownership.
12 */
13
14/*! \file */
15
16#include <config.h>
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
26
27/*%
28 * When adding a new category, be sure to add the appropriate
29 * \#define to <ns/log.h>
30 */
31LIBNS_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 */
47LIBNS_EXTERNAL_DATA isc_logmodule_t ns_modules[] = {
48	{ "ns/main",	 		0 },
49	{ "ns/client",	 		0 },
50	{ "ns/server",		 	0 },
51	{ "ns/query",		 	0 },
52	{ "ns/interfacemgr",	 	0 },
53	{ "ns/update",	 		0 },
54	{ "ns/xfer-in",	 		0 },
55	{ "ns/xfer-out", 		0 },
56	{ "ns/notify",	 		0 },
57	{ "ns/control",	 		0 },
58	{ NULL, 			0 }
59};
60
61LIBNS_EXTERNAL_DATA isc_log_t *ns_lctx = NULL;
62
63void
64ns_log_init(isc_log_t *lctx) {
65	REQUIRE(lctx != NULL);
66
67	isc_log_registercategories(lctx, ns_categories);
68	isc_log_registermodules(lctx, ns_modules);
69}
70
71void
72ns_log_setcontext(isc_log_t *lctx) {
73	ns_lctx = lctx;
74}
75