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