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