]> git.sur5r.net Git - openldap/commitdiff
detect debug level and output to stdout
authorGary Williams <gwilliams@openldap.org>
Thu, 6 May 1999 14:47:55 +0000 (14:47 +0000)
committerGary Williams <gwilliams@openldap.org>
Thu, 6 May 1999 14:47:55 +0000 (14:47 +0000)
servers/slapd/nt_debug.c

index e506531b825f840b2e76a408a5972b9022b87ccc..a2aa623f955a9c8fc56fdc0478d25d156e131a2c 100644 (file)
@@ -1,6 +1,9 @@
 #include <stdio.h>
 #include <stdarg.h>
 
+#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 );
 }