xref: /onnv-gate/usr/src/lib/libldap4/include/log.h (revision 3857:21b9b714e4ab)
1 /*
2  *
3  * Copyright 1998 Sun Microsystems, Inc.  All rights reserved.
4  * Use is subject to license terms.
5  *
6  */
7 #pragma ident	"%Z%%M%	%I%	%E% SMI"
8 
9 #ifndef _LLOG_H
10 #define _LLOG_H
11 
12 
13 #include <stdio.h>
14 #include <sys/types.h>
15 #include <sys/stat.h>
16 #include <nl_types.h>
17 #include <limits.h>
18 #include <syslog.h>
19 #include <portable.h>
20 
21 
22 
23 /* Log levels */
24 
25 /* slapd values */
26 #define LDAP_DEBUG_TRACE        0x001
27 #define LDAP_DEBUG_PACKETS      0x002
28 #define LDAP_DEBUG_ARGS         0x004
29 #define LDAP_DEBUG_CONNS        0x008
30 #define LDAP_DEBUG_BER          0x010
31 #define LDAP_DEBUG_FILTER       0x020
32 #define LDAP_DEBUG_CONFIG       0x040
33 #define LDAP_DEBUG_ACL          0x080
34 #define LDAP_DEBUG_STATS        0x100
35 #define LDAP_DEBUG_STATS2       0x200
36 #define LDAP_DEBUG_SHELL        0x400
37 #define LDAP_DEBUG_PARSE        0x800
38 /* More values for http gateway */
39 #define LDAP_DEBUG_GWAY		0x1000
40 #define LDAP_DEBUG_GWAYMORE	0x2000
41 /* Generic values */
42 #define LDAP_DEBUG_ANY		0xffff
43 
44 nl_catd	sundscat;
45 extern nl_catd	slapdcat;
46 extern void 	ldaplogconfig(char * logf, int size);
47 extern void	ldaplogconfigf(FILE *fd);
48 extern void	ldaploginit(char *name,
49 			int facility);
50 extern void	ldaploginitlevel(char *name,
51 			    int facility,
52 			    int log_level);
53 extern void 	ldaplog(int level,char *fmt,...);
54 
55 #define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 )  \
56 { \
57 	if ( log_debug & level ) \
58 		fprintf( stderr, fmt, connid, opid, arg1, arg2, arg3 );\
59 	if ( log_syslog & level ) \
60 		ldaplog( level, fmt, connid, opid, arg1, arg2, arg3 ); \
61 }
62 #endif /* _LLOG_H */
63 
64 
65 
66