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