xref: /netbsd-src/external/mpl/bind/dist/lib/ns/include/ns/log.h (revision bcda20f65a8566e103791ec395f7f499ef322704)
1 /*	$NetBSD: log.h,v 1.8 2025/01/26 16:25:46 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 #pragma once
17 
18 /*! \file */
19 
20 #include <isc/log.h>
21 #include <isc/types.h>
22 
23 extern isc_log_t	*ns_lctx;
24 extern isc_logcategory_t ns_categories[];
25 extern isc_logmodule_t	 ns_modules[];
26 
27 #define NS_LOGCATEGORY_CLIENT	       (&ns_categories[0])
28 #define NS_LOGCATEGORY_NETWORK	       (&ns_categories[1])
29 #define NS_LOGCATEGORY_UPDATE	       (&ns_categories[2])
30 #define NS_LOGCATEGORY_QUERIES	       (&ns_categories[3])
31 #define NS_LOGCATEGORY_UPDATE_SECURITY (&ns_categories[4])
32 #define NS_LOGCATEGORY_QUERY_ERRORS    (&ns_categories[5])
33 #define NS_LOGCATEGORY_TAT	       (&ns_categories[6])
34 #define NS_LOGCATEGORY_SERVE_STALE     (&ns_categories[7])
35 #define NS_LOGCATEGORY_RESPONSES       (&ns_categories[8])
36 
37 /*
38  * Backwards compatibility.
39  */
40 #define NS_LOGCATEGORY_GENERAL ISC_LOGCATEGORY_GENERAL
41 
42 #define NS_LOGMODULE_CLIENT	  (&ns_modules[0])
43 #define NS_LOGMODULE_QUERY	  (&ns_modules[1])
44 #define NS_LOGMODULE_INTERFACEMGR (&ns_modules[2])
45 #define NS_LOGMODULE_UPDATE	  (&ns_modules[3])
46 #define NS_LOGMODULE_XFER_IN	  (&ns_modules[4])
47 #define NS_LOGMODULE_XFER_OUT	  (&ns_modules[5])
48 #define NS_LOGMODULE_NOTIFY	  (&ns_modules[6])
49 #define NS_LOGMODULE_HOOKS	  (&ns_modules[7])
50 
51 void
52 ns_log_init(isc_log_t *lctx);
53 /*%<
54  * Make the libns categories and modules available for use with the
55  * ISC logging library.
56  *
57  * Requires:
58  *\li	lctx is a valid logging context.
59  *
60  *\li	ns_log_init() is called only once.
61  *
62  * Ensures:
63  *\li	The categories and modules defined above are available for
64  * 	use by isc_log_usechannnel() and isc_log_write().
65  */
66 
67 void
68 ns_log_setcontext(isc_log_t *lctx);
69 /*%<
70  * Make the libns library use the provided context for logging internal
71  * messages.
72  *
73  * Requires:
74  *\li	lctx is a valid logging context.
75  */
76