Home | History | Annotate | Line # | Download | only in named
      1 /*	$NetBSD: log.h,v 1.8 2025/01/26 16:24:34 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 #pragma once
     17 
     18 /*! \file */
     19 
     20 #include <isc/log.h>
     21 #include <isc/types.h>
     22 
     23 #include <dns/log.h>
     24 
     25 #include <named/globals.h> /* Required for named_g_(categories|modules). */
     26 
     27 /* Unused slot 0. */
     28 #define NAMED_LOGCATEGORY_UNMATCHED (&named_g_categories[1])
     29 
     30 /*
     31  * Backwards compatibility.
     32  */
     33 #define NAMED_LOGCATEGORY_GENERAL ISC_LOGCATEGORY_GENERAL
     34 
     35 #define NAMED_LOGMODULE_MAIN	(&named_g_modules[0])
     36 #define NAMED_LOGMODULE_SERVER	(&named_g_modules[1])
     37 #define NAMED_LOGMODULE_CONTROL (&named_g_modules[2])
     38 
     39 isc_result_t
     40 named_log_init(bool safe);
     41 /*%
     42  * Initialize the logging system and set up an initial default
     43  * logging default configuration that will be used until the
     44  * config file has been read.
     45  *
     46  * If 'safe' is true, use a default configuration that refrains
     47  * from opening files.  This is to avoid creating log files
     48  * as root.
     49  */
     50 
     51 void
     52 named_log_setdefaultchannels(isc_logconfig_t *lcfg);
     53 /*%
     54  * Set up logging channels according to the named defaults, which
     55  * may differ from the logging library defaults.  Currently,
     56  * this just means setting up default_debug.
     57  */
     58 
     59 void
     60 named_log_setsafechannels(isc_logconfig_t *lcfg);
     61 /*%
     62  * Like named_log_setdefaultchannels(), but omits any logging to files.
     63  */
     64 
     65 void
     66 named_log_setdefaultsslkeylogfile(isc_logconfig_t *lcfg);
     67 /*%
     68  * If the SSLKEYLOGFILE environment variable is set, sets up a default
     69  * logging channel for writing TLS pre-master secrets to the path stored
     70  * in that environment variable (for debugging purposes).
     71  */
     72 
     73 isc_result_t
     74 named_log_setdefaultcategory(isc_logconfig_t *lcfg);
     75 /*%
     76  * Set up "category default" to go to the right places.
     77  */
     78 
     79 isc_result_t
     80 named_log_setunmatchedcategory(isc_logconfig_t *lcfg);
     81 /*%
     82  * Set up "category unmatched" to go to the right places.
     83  */
     84 
     85 void
     86 named_log_shutdown(void);
     87