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