xref: /titanic_41/usr/src/cmd/nscd/nscd_log.h (revision 18bdb8a7484e018149ac9a2766c97bdea9752c87)
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 2007 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_CACHE		0x0001
45 #define	NSCD_LOG_SWITCH_ENGINE	0x0002
46 #define	NSCD_LOG_FRONT_END	0x0004
47 #define	NSCD_LOG_SELF_CRED	0x0008
48 #define	NSCD_LOG_ADMIN		0x0010	/*   16 */
49 #define	NSCD_LOG_CONFIG		0x0020  /*   32 */
50 #define	NSCD_LOG_SMF_MONITOR	0x0040  /*   64 */
51 #define	NSCD_LOG_NSW_STATE	0x0080  /*  128 */
52 #define	NSCD_LOG_GETENT_CTX	0x0100  /*  256 */
53 #define	NSCD_LOG_ACCESS_INFO	0x0200  /*  512 */
54 #define	NSCD_LOG_INT_ADDR	0x0400  /* 1024 */
55 #define	NSCD_LOG_ALL		0x07ff  /* 2047 */
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_FIND	0x0001
62 #define	NSCD_LOG_LEVEL_DEBUG		0x0100  /*   256 */
63 #define	NSCD_LOG_LEVEL_ERROR		0x0200  /*   512 */
64 #define	NSCD_LOG_LEVEL_WARNING		0x0400  /*  1024 */
65 #define	NSCD_LOG_LEVEL_INFO		0x0800  /*  2048 */
66 #define	NSCD_LOG_LEVEL_NOTICE		0x1000	/*  4096 */
67 #define	NSCD_LOG_LEVEL_ALERT		0x2000  /*  8192 */
68 #define	NSCD_LOG_LEVEL_CRIT		0x4000  /* 16384 */
69 #define	NSCD_LOG_LEVEL_ALL		0x7fff  /* 32767 */
70 
71 /*
72  * debug level: for backward compatibility
73  */
74 #define	NSCD_LOG_LEVEL_DEBUG_6 (NSCD_LOG_LEVEL_CANT_FIND | NSCD_LOG_LEVEL_ERROR)
75 
76 /*
77  * _nscd_log_comp and _nscd_log_level defined in nscd_log.c
78  */
79 extern int _nscd_log_comp;
80 extern int _nscd_log_level;
81 
82 #define	_NSCD_LOG(comp, lvl)	if ((_nscd_log_comp & (comp)) && \
83 					(_nscd_log_level & (lvl))) \
84 				_nscd_logit
85 
86 #define	_NSCD_LOG_IF(comp, lvl)	if ((_nscd_log_comp & (comp)) && \
87 					(_nscd_log_level & (lvl)))
88 
89 
90 /*
91  * prototypes
92  */
93 void		_nscd_logit(char *funcname, char *format, ...);
94 nscd_rc_t	_nscd_set_debug_level(int level);
95 nscd_rc_t	_nscd_set_log_file(char *name);
96 void		_nscd_get_log_info(char *level, int llen, char *file, int flen);
97 
98 #ifdef	__cplusplus
99 }
100 #endif
101 
102 #endif	/* _NSCD_LOG_H */
103