xref: /titanic_41/usr/src/cmd/nscd/nscd_log.h (revision a192e900f6d2b0e1a822e3252c0dfd795ed49d76)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_NSCD_LOG_H
27 #define	_NSCD_LOG_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #include "nscd_common.h"
36 
37 /*
38  * nscd logging options
39  */
40 /*
41  * components: select more than one by OR'ing
42  */
43 #define	NSCD_LOG_NONE		0x0000
44 #define	NSCD_LOG_ACCESS_INFO	0x0001
45 #define	NSCD_LOG_INT_ADDR	0x0002
46 #define	NSCD_LOG_NSW_STATE	0x0004
47 #define	NSCD_LOG_GETENT_CTX	0x0008
48 #define	NSCD_LOG_SWITCH_ENGINE	0x0010
49 #define	NSCD_LOG_CONFIG		0x0020
50 #define	NSCD_LOG_FRONT_END	0x0040
51 #define	NSCD_LOG_CACHE		0x0080
52 #define	NSCD_LOG_SMF_MONITOR	0x0100
53 #define	NSCD_LOG_ADMIN		0x0200
54 #define	NSCD_LOG_SELF_CRED	0x0400
55 #define	NSCD_LOG_ALL		0x07ff
56 
57 /*
58  * debug level: select more than one by OR'ing
59  */
60 #define	NSCD_LOG_LEVEL_NONE		0x0000
61 #define	NSCD_LOG_LEVEL_CANT_FOUND	0x0001
62 #define	NSCD_LOG_LEVEL_ALERT		0x0002
63 #define	NSCD_LOG_LEVEL_CRIT		0x0004
64 #define	NSCD_LOG_LEVEL_ERROR		0x0008
65 #define	NSCD_LOG_LEVEL_WARNING		0x0010
66 #define	NSCD_LOG_LEVEL_NOTICE		0x0020
67 #define	NSCD_LOG_LEVEL_INFO		0x0040
68 #define	NSCD_LOG_LEVEL_DEBUG		0x0080
69 #define	NSCD_LOG_LEVEL_ALL		0x00ff
70 
71 /*
72  * _nscd_log_comp and _nscd_log_level defined in nscd_log.c
73  */
74 extern int _nscd_log_comp;
75 extern int _nscd_log_level;
76 
77 #define	_NSCD_LOG(comp, lvl)	if ((_nscd_log_comp & (comp)) && \
78 					(_nscd_log_level & (lvl))) \
79 				_nscd_logit
80 
81 #define	_NSCD_LOG_IF(comp, lvl)	if ((_nscd_log_comp & (comp)) && \
82 					(_nscd_log_level & (lvl)))
83 
84 
85 /*
86  * prototypes
87  */
88 void		_nscd_logit(char *funcname, char *format, ...);
89 nscd_rc_t	_nscd_set_debug_level(int level);
90 nscd_rc_t	_nscd_set_log_file(char *name);
91 
92 #ifdef	__cplusplus
93 }
94 #endif
95 
96 #endif	/* _NSCD_LOG_H */
97