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