]> git.sur5r.net Git - openldap/blob - include/ldap_log.h
Add LDAP_CONST macro for use within EXTERNAL headers such as
[openldap] / include / ldap_log.h
1 /*
2  * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted only
6  * as authorized by the OpenLDAP Public License.  A copy of this
7  * license is available at http://www.OpenLDAP.org/license.html or
8  * in file LICENSE in the top-level directory of the distribution.
9  */
10 /* Portions
11  * Copyright (c) 1990 Regents of the University of Michigan.
12  * All rights reserved.
13  *
14  * Redistribution and use in source and binary forms are permitted
15  * provided that this notice is preserved and that due credit is given
16  * to the University of Michigan at Ann Arbor. The name of the University
17  * may not be used to endorse or promote products derived from this
18  * software without specific prior written permission. This software
19  * is provided ``as is'' without express or implied warranty.
20  */
21
22 #ifndef _LDAP_LOG_H
23 #define _LDAP_LOG_H
24
25 #include <ldap_cdefs.h>
26
27 LDAP_BEGIN_DECL
28
29 #define LDAP_DEBUG_TRACE        0x0001
30 #define LDAP_DEBUG_PACKETS      0x0002
31 #define LDAP_DEBUG_ARGS         0x0004
32 #define LDAP_DEBUG_CONNS        0x0008
33 #define LDAP_DEBUG_BER          0x0010
34 #define LDAP_DEBUG_FILTER       0x0020
35 #define LDAP_DEBUG_CONFIG       0x0040
36 #define LDAP_DEBUG_ACL          0x0080
37 #define LDAP_DEBUG_STATS        0x0100
38 #define LDAP_DEBUG_STATS2       0x0200
39 #define LDAP_DEBUG_SHELL        0x0400
40 #define LDAP_DEBUG_PARSE        0x0800
41
42 #define LDAP_DEBUG_DEPRECIATED  0x1000
43 #define LDAP_DEBUG_NONE         0x8000
44 #define LDAP_DEBUG_ANY          -1
45
46 /* debugging stuff */
47 #ifdef LDAP_DEBUG
48
49 #ifndef ldap_debug
50 extern int      ldap_debug;
51 #endif /* !ldap_debug */
52
53 #ifdef LDAP_SYSLOG
54 extern int      ldap_syslog;
55 extern int      ldap_syslog_level;
56 #endif /* LDAP_SYSLOG */
57
58 /* this doesn't below as part of ldap.h */
59 #ifdef LDAP_SYSLOG
60 #define Debug( level, fmt, arg1, arg2, arg3 )   \
61         do { \
62                 if ( ldap_debug & (level) ) \
63                         fprintf( stderr, (fmt), (arg1), (arg2), (arg3) ); \
64                 if ( ldap_syslog & (level) ) \
65                         syslog( ldap_syslog_level, (fmt), (arg1), (arg2), (arg3) ); \
66         } while ( 0 )
67 #else /* LDAP_SYSLOG */
68 #ifndef HAVE_WINSOCK
69 #define Debug( level, fmt, arg1, arg2, arg3 ) \
70         do { \
71                 if ( ldap_debug & (level) ) \
72                         fprintf( stderr, (fmt), (arg1), (arg2), (arg3) ); \
73         } while ( 0 )
74 #else /* !WINSOCK */
75 extern void Debug( int level, char* fmt, ... );
76 #endif /* !WINSOCK */
77 #endif /* LDAP_SYSLOG */
78 #else /* LDAP_DEBUG */
79 #define Debug( level, fmt, arg1, arg2, arg3 )
80 #endif /* LDAP_DEBUG */
81
82 LDAP_END_DECL
83
84 #endif /* _LDAP_LOG_H */