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