Home | History | Annotate | Line # | Download | only in ns
      1 /*	$NetBSD: log.c,v 1.8 2025/01/26 16:25:45 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 isc_logcategory_t ns_categories[] = { { "client", 0 },
     32 				      { "network", 0 },
     33 				      { "update", 0 },
     34 				      { "queries", 0 },
     35 				      { "update-security", 0 },
     36 				      { "query-errors", 0 },
     37 				      { "trust-anchor-telemetry", 0 },
     38 				      { "serve-stale", 0 },
     39 				      { "responses", 0 },
     40 				      { NULL, 0 } };
     41 
     42 /*%
     43  * When adding a new module, be sure to add the appropriate
     44  * \#define to <ns/log.h>.
     45  */
     46 isc_logmodule_t ns_modules[] = {
     47 	{ "ns/client", 0 }, { "ns/query", 0 },	 { "ns/interfacemgr", 0 },
     48 	{ "ns/update", 0 }, { "ns/xfer-in", 0 }, { "ns/xfer-out", 0 },
     49 	{ "ns/notify", 0 }, { "ns/hooks", 0 },	 { NULL, 0 }
     50 };
     51 
     52 isc_log_t *ns_lctx = NULL;
     53 
     54 void
     55 ns_log_init(isc_log_t *lctx) {
     56 	REQUIRE(lctx != NULL);
     57 
     58 	isc_log_registercategories(lctx, ns_categories);
     59 	isc_log_registermodules(lctx, ns_modules);
     60 }
     61 
     62 void
     63 ns_log_setcontext(isc_log_t *lctx) {
     64 	ns_lctx = lctx;
     65 }
     66