Home | History | Annotate | Line # | Download | only in ns
log.c revision 1.4
      1  1.1  christos /*	$NetBSD: log.c,v 1.4 2020/05/24 19:46:29 christos Exp $	*/
      2  1.1  christos 
      3  1.1  christos /*
      4  1.1  christos  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      5  1.1  christos  *
      6  1.1  christos  * This Source Code Form is subject to the terms of the Mozilla Public
      7  1.1  christos  * License, v. 2.0. If a copy of the MPL was not distributed with this
      8  1.1  christos  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
      9  1.1  christos  *
     10  1.1  christos  * See the COPYRIGHT file distributed with this work for additional
     11  1.1  christos  * information regarding copyright ownership.
     12  1.1  christos  */
     13  1.1  christos 
     14  1.1  christos /*! \file */
     15  1.1  christos 
     16  1.1  christos #include <isc/result.h>
     17  1.1  christos #include <isc/util.h>
     18  1.1  christos 
     19  1.1  christos #include <ns/log.h>
     20  1.1  christos 
     21  1.1  christos #ifndef ISC_FACILITY
     22  1.1  christos #define ISC_FACILITY LOG_DAEMON
     23  1.4  christos #endif /* ifndef ISC_FACILITY */
     24  1.1  christos 
     25  1.1  christos /*%
     26  1.1  christos  * When adding a new category, be sure to add the appropriate
     27  1.1  christos  * \#define to <ns/log.h>
     28  1.1  christos  */
     29  1.1  christos LIBNS_EXTERNAL_DATA isc_logcategory_t ns_categories[] = {
     30  1.4  christos 	{ "client", 0 },
     31  1.4  christos 	{ "network", 0 },
     32  1.4  christos 	{ "update", 0 },
     33  1.4  christos 	{ "queries", 0 },
     34  1.4  christos 	{ "update-security", 0 },
     35  1.4  christos 	{ "query-errors", 0 },
     36  1.4  christos 	{ "trust-anchor-telemetry", 0 },
     37  1.4  christos 	{ "serve-stale", 0 },
     38  1.4  christos 	{ NULL, 0 }
     39  1.1  christos };
     40  1.1  christos 
     41  1.1  christos /*%
     42  1.1  christos  * When adding a new module, be sure to add the appropriate
     43  1.1  christos  * \#define to <ns/log.h>.
     44  1.1  christos  */
     45  1.1  christos LIBNS_EXTERNAL_DATA isc_logmodule_t ns_modules[] = {
     46  1.4  christos 	{ "ns/client", 0 }, { "ns/query", 0 },	 { "ns/interfacemgr", 0 },
     47  1.4  christos 	{ "ns/update", 0 }, { "ns/xfer-in", 0 }, { "ns/xfer-out", 0 },
     48  1.4  christos 	{ "ns/notify", 0 }, { "ns/hooks", 0 },	 { NULL, 0 }
     49  1.1  christos };
     50  1.1  christos 
     51  1.1  christos LIBNS_EXTERNAL_DATA isc_log_t *ns_lctx = NULL;
     52  1.1  christos 
     53  1.1  christos void
     54  1.1  christos ns_log_init(isc_log_t *lctx) {
     55  1.1  christos 	REQUIRE(lctx != NULL);
     56  1.1  christos 
     57  1.1  christos 	isc_log_registercategories(lctx, ns_categories);
     58  1.1  christos 	isc_log_registermodules(lctx, ns_modules);
     59  1.1  christos }
     60  1.1  christos 
     61  1.1  christos void
     62  1.1  christos ns_log_setcontext(isc_log_t *lctx) {
     63  1.1  christos 	ns_lctx = lctx;
     64  1.1  christos }
     65