1/* $NetBSD: log.c,v 1.7 2024/02/21 22:52: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/*! \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 */ 31isc_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 { NULL, 0 } }; 40 41/*% 42 * When adding a new module, be sure to add the appropriate 43 * \#define to <ns/log.h>. 44 */ 45isc_logmodule_t ns_modules[] = { 46 { "ns/client", 0 }, { "ns/query", 0 }, { "ns/interfacemgr", 0 }, 47 { "ns/update", 0 }, { "ns/xfer-in", 0 }, { "ns/xfer-out", 0 }, 48 { "ns/notify", 0 }, { "ns/hooks", 0 }, { NULL, 0 } 49}; 50 51isc_log_t *ns_lctx = NULL; 52 53void 54ns_log_init(isc_log_t *lctx) { 55 REQUIRE(lctx != NULL); 56 57 isc_log_registercategories(lctx, ns_categories); 58 isc_log_registermodules(lctx, ns_modules); 59} 60 61void 62ns_log_setcontext(isc_log_t *lctx) { 63 ns_lctx = lctx; 64} 65