]> git.sur5r.net Git - openldap/blob - include/ldap_log.h
Added lber_get/set_option. Removed lber_debug/ldap_debug.
[openldap] / include / ldap_log.h
1 /*
2  * Copyright (c) 1990 Regents of the University of Michigan.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that this notice is preserved and that due credit is given
7  * to the University of Michigan at Ann Arbor. The name of the University
8  * may not be used to endorse or promote products derived from this
9  * software without specific prior written permission. This software
10  * is provided ``as is'' without express or implied warranty.
11  */
12
13 #ifndef _LDAP_LOG_H
14 #define _LDAP_LOG_H
15
16 #include <ldap_cdefs.h>
17
18 LDAP_BEGIN_DECL
19
20 /* debugging stuff */
21 #ifdef LDAP_DEBUG
22
23 #ifndef ldap_debug
24 extern int      ldap_debug;
25 #endif /* !ldap_debug */
26
27 #ifdef LDAP_SYSLOG
28 extern int      ldap_syslog;
29 extern int      ldap_syslog_level;
30 #endif /* LDAP_SYSLOG */
31
32 #define LDAP_DEBUG_TRACE        0x0001
33 #define LDAP_DEBUG_PACKETS      0x0002
34 #define LDAP_DEBUG_ARGS         0x0004
35 #define LDAP_DEBUG_CONNS        0x0008
36 #define LDAP_DEBUG_BER          0x0010
37 #define LDAP_DEBUG_FILTER       0x0020
38 #define LDAP_DEBUG_CONFIG       0x0040
39 #define LDAP_DEBUG_ACL          0x0080
40 #define LDAP_DEBUG_STATS        0x0100
41 #define LDAP_DEBUG_STATS2       0x0200
42 #define LDAP_DEBUG_SHELL        0x0400
43 #define LDAP_DEBUG_PARSE        0x0800
44
45 #define LDAP_DEBUG_NONE         0x8000
46 #define LDAP_DEBUG_ANY          -1
47
48 /* this doesn't below as part of ldap.h */
49 #ifdef LDAP_SYSLOG
50 #define Debug( level, fmt, arg1, arg2, arg3 )   \
51         { \
52                 if ( ldap_debug & (level) ) \
53                         fprintf( stderr, (fmt), (arg1), (arg2), (arg3) ); \
54                 if ( ldap_syslog & level ) \
55                         syslog( ldap_syslog_level, (fmt), (arg1), (arg2), (arg3) ); \
56         }
57 #else /* LDAP_SYSLOG */
58 #ifndef WINSOCK
59 #define Debug( level, fmt, arg1, arg2, arg3 ) \
60                 if ( ldap_debug & (level) ) \
61                         fprintf( stderr, (fmt), (arg1), (arg2), (arg3) );
62 #else /* !WINSOCK */
63 extern void Debug( int level, char* fmt, ... );
64 #endif /* !WINSOCK */
65 #endif /* LDAP_SYSLOG */
66 #else /* LDAP_DEBUG */
67 #define Debug( level, fmt, arg1, arg2, arg3 )
68 #endif /* LDAP_DEBUG */
69
70 LDAP_END_DECL
71
72 #endif /* _LDAP_LOG_H */