From ed703cbc5ec3a5df810f9f5d99cea36dbb9f0030 Mon Sep 17 00:00:00 2001 From: Gary Williams Date: Thu, 6 May 1999 14:47:55 +0000 Subject: [PATCH] detect debug level and output to stdout --- servers/slapd/nt_debug.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/servers/slapd/nt_debug.c b/servers/slapd/nt_debug.c index e506531b82..a2aa623f95 100644 --- a/servers/slapd/nt_debug.c +++ b/servers/slapd/nt_debug.c @@ -1,6 +1,9 @@ #include #include +#include "portable.h" +#include "slap.h" + static FILE *log_file; void Debug( int level, char *fmt, ... ) @@ -8,12 +11,26 @@ void Debug( int level, char *fmt, ... ) char buffer[4096]; va_list vl; + if ( !(level & ldap_debug ) ) + return; + if( log_file == NULL ) + { log_file = fopen( "C:\\OpenLDAP\\run\\slapd.log", "w" ); + if ( log_file == NULL ) + log_file = fopen( "slapd.log", "w" ); + + if ( log_file == NULL ) + return; + } + va_start( vl, fmt ); vsprintf( buffer, fmt, vl ); - fprintf( log_file, "%s\n", buffer ); + fprintf( log_file, "%s", buffer ); + + printf ("%s", buffer); + fflush( log_file ); va_end( vl ); } -- 2.39.5