3 * Copyright 1998-2000 The OpenLDAP Foundation, Redwood City, California, USA
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.
12 * Copyright (c) 1990 Regents of the University of Michigan.
13 * All rights reserved.
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.
27 #include <ldap_cdefs.h>
32 * While it's not important that the subsystem number are
33 * contiguous, it is important that the NUM_SUBSYS accurately
34 * reflect the number of subsystems and MAX_SUBSYS reflect
35 * the largest subsystem number.
40 #define LDAP_SUBSYS_GLOBAL 0
41 #define LDAP_SUBSYS_OPERATION 1
42 #define LDAP_SUBSYS_TRANSPORT 2
43 #define LDAP_SUBSYS_CONNECTION 3
44 #define LDAP_SUBSYS_FILTER 4
45 #define LDAP_SUBSYS_BACKEND 5
46 #define LDAP_SUBSYS_BER 6
47 #define LDAP_SUBSYS_CONFIG 7
48 #define LDAP_SUBSYS_ACL 8
49 #define LDAP_SUBSYS_CACHE 9
50 #define LDAP_SUBSYS_INDEX 10
51 #define LDAP_SUBSYS_LDIF 11
54 * debug reporting levels.
56 * They start with the syslog levels, and
57 * go down in importance. The normal
58 * debugging levels begin with LDAP_LEVEL_ENTRY
61 #define LDAP_LEVEL_EMERG 0
62 #define LDAP_LEVEL_ALERT 1
63 #define LDAP_LEVEL_CRIT 2
64 #define LDAP_LEVEL_ERR 3
65 #define LDAP_LEVEL_WARNING 4
66 #define LDAP_LEVEL_NOTICE 5
67 #define LDAP_LEVEL_INFO 6
68 #define LDAP_LEVEL_ENTRY 7 /* log function entry points */
69 #define LDAP_LEVEL_ARGS 8 /* log function call parameters */
70 #define LDAP_LEVEL_RESULTS 9 /* Log function results */
71 #define LDAP_LEVEL_DETAIL1 10 /* log level 1 function operational details */
72 #define LDAP_LEVEL_DETAIL2 11 /* Log level 2 function operational details */
74 #define LDAP_DEBUG_TRACE 0x0001
75 #define LDAP_DEBUG_PACKETS 0x0002
76 #define LDAP_DEBUG_ARGS 0x0004
77 #define LDAP_DEBUG_CONNS 0x0008
78 #define LDAP_DEBUG_BER 0x0010
79 #define LDAP_DEBUG_FILTER 0x0020
80 #define LDAP_DEBUG_CONFIG 0x0040
81 #define LDAP_DEBUG_ACL 0x0080
82 #define LDAP_DEBUG_STATS 0x0100
83 #define LDAP_DEBUG_STATS2 0x0200
84 #define LDAP_DEBUG_SHELL 0x0400
85 #define LDAP_DEBUG_PARSE 0x0800
86 #define LDAP_DEBUG_CACHE 0x1000
87 #define LDAP_DEBUG_INDEX 0x2000
89 #define LDAP_DEBUG_DEPRECATED 0x1000
90 #define LDAP_DEBUG_NONE 0x8000
91 #define LDAP_DEBUG_ANY -1
97 * This is a bogus extern declaration for the compiler. No need to ensure
98 * a 'proper' dllimport.
101 extern int ldap_debug;
102 # endif /* !ldap_debug */
105 extern int ldap_syslog;
106 extern int ldap_syslog_level;
107 # endif /* LDAP_SYSLOG */
109 /* this doesn't below as part of ldap.h */
111 # define Debug( level, fmt, arg1, arg2, arg3 ) \
113 lutil_debug( ldap_debug, (level), (fmt), (arg1), (arg2), (arg3) ); \
114 if ( ldap_syslog & (level) ) \
115 syslog( ldap_syslog_level, (fmt), (arg1), (arg2), (arg3) ); \
119 # define Debug( level, fmt, arg1, arg2, arg3 ) \
120 lutil_debug( ldap_debug, (level), (fmt), (arg1), (arg2), (arg3) )
124 # define LDAP_LOG(a) lutil_log a
127 #else /* LDAP_DEBUG */
128 # define Debug( level, fmt, arg1, arg2, arg3 )
134 #endif /* LDAP_DEBUG */
137 LDAP_LUTIL_F(void) lutil_log_initialize(int argc, char **argv);
138 LDAP_LUTIL_F(void) lutil_set_debug_level LDAP_P(( char *subsys, int level ));
139 LDAP_LUTIL_F(void) lutil_log LDAP_P(( char *subsys, int level, const char *fmt, ... ));
140 /*LDAP_LUTIL_F(void) lutil_log_int LDAP_P(( FILE* file, char *subsys, int level, const char *fmt, va_list vl ));*/
142 LDAP_LUTIL_F(int) lutil_debug_file LDAP_P(( FILE *file ));
145 LDAP_LUTIL_F(void) lutil_debug LDAP_P((
146 int debug, int level,
147 const char* fmt, ... )) LDAP_GCCATTR((format(printf, 3, 4)));
151 #endif /* _LDAP_LOG_H */