1 /*
2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3  *
4  * SPDX-License-Identifier: MPL-2.0
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 https://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 #ifndef NAMED_LOG_H
15 #define NAMED_LOG_H 1
16 
17 /*! \file */
18 
19 #include <isc/log.h>
20 #include <isc/types.h>
21 
22 #include <dns/log.h>
23 
24 #include <named/globals.h> /* Required for named_g_(categories|modules). */
25 
26 /* Unused slot 0. */
27 #define NAMED_LOGCATEGORY_UNMATCHED (&named_g_categories[1])
28 
29 /*
30  * Backwards compatibility.
31  */
32 #define NAMED_LOGCATEGORY_GENERAL ISC_LOGCATEGORY_GENERAL
33 
34 #define NAMED_LOGMODULE_MAIN	(&named_g_modules[0])
35 #define NAMED_LOGMODULE_SERVER	(&named_g_modules[1])
36 #define NAMED_LOGMODULE_CONTROL (&named_g_modules[2])
37 
38 isc_result_t
39 named_log_init(bool safe);
40 /*%
41  * Initialize the logging system and set up an initial default
42  * logging default configuration that will be used until the
43  * config file has been read.
44  *
45  * If 'safe' is true, use a default configuration that refrains
46  * from opening files.  This is to avoid creating log files
47  * as root.
48  */
49 
50 void
51 named_log_setdefaultchannels(isc_logconfig_t *lcfg);
52 /*%
53  * Set up logging channels according to the named defaults, which
54  * may differ from the logging library defaults.  Currently,
55  * this just means setting up default_debug.
56  */
57 
58 void
59 named_log_setsafechannels(isc_logconfig_t *lcfg);
60 /*%
61  * Like named_log_setdefaultchannels(), but omits any logging to files.
62  */
63 
64 isc_result_t
65 named_log_setdefaultcategory(isc_logconfig_t *lcfg);
66 /*%
67  * Set up "category default" to go to the right places.
68  */
69 
70 isc_result_t
71 named_log_setunmatchedcategory(isc_logconfig_t *lcfg);
72 /*%
73  * Set up "category unmatched" to go to the right places.
74  */
75 
76 void
77 named_log_shutdown(void);
78 
79 #endif /* NAMED_LOG_H */
80