-# else
-# define Debug( level, fmt, arg1, arg2, arg3 ) \
- lutil_debug( ldap_debug, (level), (fmt), (arg1), (arg2), (arg3) )
-# endif
-
-#ifndef LDAP_LOG
-# define LDAP_LOG(a) lutil_log a
-#endif
-
-#else /* LDAP_DEBUG */
-# define Debug( level, fmt, arg1, arg2, arg3 )
-
-#ifndef LDAP_LOG
-# define LDAP_LOG(a)
-#endif
-
-#endif /* LDAP_DEBUG */
-
-
-LDAP_LUTIL_F(int) lutil_mnem2level LDAP_P(( char *level ));
-LDAP_LUTIL_F(void) lutil_log_initialize(int argc, char **argv);
-LDAP_LUTIL_F(void) lutil_set_debug_level LDAP_P(( char *subsys, int level ));
-LDAP_LUTIL_F(void) lutil_log LDAP_P(( char *subsys, int level, const char *fmt, ... ));
+#else /* ! LDAP_SYSLOG */
+#define Log0( level, severity, fmt ) \
+ do { \
+ if ( ldap_debug & (level) ) \
+ lutil_debug( ldap_debug, (level), (fmt) ); \
+ } while ( 0 )
+#define Log1( level, severity, fmt, arg1 ) \
+ do { \
+ if ( ldap_debug & (level) ) \
+ lutil_debug( ldap_debug, (level), (fmt), (arg1) ); \
+ } while ( 0 )
+#define Log2( level, severity, fmt, arg1, arg2 ) \
+ do { \
+ if ( ldap_debug & (level) ) \
+ lutil_debug( ldap_debug, (level), (fmt), (arg1), (arg2) ); \
+ } while ( 0 )
+#define Log3( level, severity, fmt, arg1, arg2, arg3 ) \
+ do { \
+ if ( ldap_debug & (level) ) \
+ lutil_debug( ldap_debug, (level), (fmt), (arg1), (arg2), (arg3) ); \
+ } while ( 0 )
+#define Log4( level, severity, fmt, arg1, arg2, arg3, arg4 ) \
+ do { \
+ if ( ldap_debug & (level) ) \
+ lutil_debug( ldap_debug, (level), (fmt), (arg1), (arg2), (arg3), (arg4) ); \
+ } while ( 0 )
+#define Log5( level, severity, fmt, arg1, arg2, arg3, arg4, arg5 ) \
+ do { \
+ if ( ldap_debug & (level) ) \
+ lutil_debug( ldap_debug, (level), (fmt), (arg1), (arg2), (arg3), (arg4), (arg5) ); \
+ } while ( 0 )
+#define Debug( level, fmt, arg1, arg2, arg3 ) \
+ Log3( (level), 0, (fmt), (arg1), (arg2), (arg3) )
+#define LogTest(level) ( ldap_debug & (level) )
+#endif /* ! LDAP_SYSLOG */
+#else /* ! LDAP_DEBUG */
+/* TODO: in case LDAP_DEBUG is undefined, make sure logs with appropriate
+ * severity gets thru anyway */
+#define Log0( level, severity, fmt ) ((void)0)
+#define Log1( level, severity, fmt, arg1 ) ((void)0)
+#define Log2( level, severity, fmt, arg1, arg2 ) ((void)0)
+#define Log3( level, severity, fmt, arg1, arg2, arg3 ) ((void)0)
+#define Log4( level, severity, fmt, arg1, arg2, arg3, arg4 ) ((void)0)
+#define Log5( level, severity, fmt, arg1, arg2, arg3, arg4, arg5 ) ((void)0)
+#define Debug( level, fmt, arg1, arg2, arg3 ) ((void)0)
+#define LogTest(level) ( 0 )
+#endif /* ! LDAP_DEBUG */