1135446Strhodes/*
2193149Sdougb * Copyright (C) 2004, 2005, 2007, 2009  Internet Systems Consortium, Inc. ("ISC")
3135446Strhodes * Copyright (C) 1999-2002  Internet Software Consortium.
4135446Strhodes *
5193149Sdougb * Permission to use, copy, modify, and/or distribute this software for any
6135446Strhodes * purpose with or without fee is hereby granted, provided that the above
7135446Strhodes * copyright notice and this permission notice appear in all copies.
8135446Strhodes *
9135446Strhodes * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10135446Strhodes * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11135446Strhodes * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12135446Strhodes * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13135446Strhodes * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14135446Strhodes * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15135446Strhodes * PERFORMANCE OF THIS SOFTWARE.
16135446Strhodes */
17135446Strhodes
18234010Sdougb/* $Id: log.h,v 1.27 2009/01/07 23:47:46 tbox Exp $ */
19135446Strhodes
20135446Strhodes#ifndef NAMED_LOG_H
21135446Strhodes#define NAMED_LOG_H 1
22135446Strhodes
23170222Sdougb/*! \file */
24170222Sdougb
25135446Strhodes#include <isc/log.h>
26135446Strhodes#include <isc/types.h>
27135446Strhodes
28135446Strhodes#include <dns/log.h>
29135446Strhodes
30135446Strhodes#include <named/globals.h>	/* Required for ns_g_(categories|modules). */
31135446Strhodes
32135446Strhodes/* Unused slot 0. */
33135446Strhodes#define NS_LOGCATEGORY_CLIENT		(&ns_g_categories[1])
34135446Strhodes#define NS_LOGCATEGORY_NETWORK		(&ns_g_categories[2])
35135446Strhodes#define NS_LOGCATEGORY_UPDATE		(&ns_g_categories[3])
36135446Strhodes#define NS_LOGCATEGORY_QUERIES		(&ns_g_categories[4])
37135446Strhodes#define NS_LOGCATEGORY_UNMATCHED	(&ns_g_categories[5])
38135446Strhodes#define NS_LOGCATEGORY_UPDATE_SECURITY	(&ns_g_categories[6])
39193149Sdougb#define NS_LOGCATEGORY_QUERY_EERRORS	(&ns_g_categories[7])
40135446Strhodes
41135446Strhodes/*
42135446Strhodes * Backwards compatibility.
43135446Strhodes */
44135446Strhodes#define NS_LOGCATEGORY_GENERAL		ISC_LOGCATEGORY_GENERAL
45135446Strhodes
46135446Strhodes#define NS_LOGMODULE_MAIN		(&ns_g_modules[0])
47135446Strhodes#define NS_LOGMODULE_CLIENT		(&ns_g_modules[1])
48135446Strhodes#define NS_LOGMODULE_SERVER		(&ns_g_modules[2])
49135446Strhodes#define NS_LOGMODULE_QUERY		(&ns_g_modules[3])
50135446Strhodes#define NS_LOGMODULE_INTERFACEMGR	(&ns_g_modules[4])
51135446Strhodes#define NS_LOGMODULE_UPDATE		(&ns_g_modules[5])
52135446Strhodes#define NS_LOGMODULE_XFER_IN		(&ns_g_modules[6])
53135446Strhodes#define NS_LOGMODULE_XFER_OUT		(&ns_g_modules[7])
54135446Strhodes#define NS_LOGMODULE_NOTIFY		(&ns_g_modules[8])
55135446Strhodes#define NS_LOGMODULE_CONTROL		(&ns_g_modules[9])
56135446Strhodes#define NS_LOGMODULE_LWRESD		(&ns_g_modules[10])
57135446Strhodes
58135446Strhodesisc_result_t
59135446Strhodesns_log_init(isc_boolean_t safe);
60170222Sdougb/*%
61135446Strhodes * Initialize the logging system and set up an initial default
62135446Strhodes * logging default configuration that will be used until the
63135446Strhodes * config file has been read.
64135446Strhodes *
65135446Strhodes * If 'safe' is true, use a default configuration that refrains
66135446Strhodes * from opening files.  This is to avoid creating log files
67135446Strhodes * as root.
68135446Strhodes */
69135446Strhodes
70135446Strhodesisc_result_t
71135446Strhodesns_log_setdefaultchannels(isc_logconfig_t *lcfg);
72170222Sdougb/*%
73135446Strhodes * Set up logging channels according to the named defaults, which
74135446Strhodes * may differ from the logging library defaults.  Currently,
75135446Strhodes * this just means setting up default_debug.
76135446Strhodes */
77135446Strhodes
78135446Strhodesisc_result_t
79135446Strhodesns_log_setsafechannels(isc_logconfig_t *lcfg);
80170222Sdougb/*%
81135446Strhodes * Like ns_log_setdefaultchannels(), but omits any logging to files.
82135446Strhodes */
83135446Strhodes
84135446Strhodesisc_result_t
85135446Strhodesns_log_setdefaultcategory(isc_logconfig_t *lcfg);
86170222Sdougb/*%
87135446Strhodes * Set up "category default" to go to the right places.
88135446Strhodes */
89135446Strhodes
90135446Strhodesisc_result_t
91135446Strhodesns_log_setunmatchedcategory(isc_logconfig_t *lcfg);
92170222Sdougb/*%
93135446Strhodes * Set up "category unmatched" to go to the right places.
94135446Strhodes */
95135446Strhodes
96135446Strhodesvoid
97135446Strhodesns_log_shutdown(void);
98135446Strhodes
99135446Strhodes#endif /* NAMED_LOG_H */
100