Skip to content
Snippets Groups Projects
Commit ed703cbc authored by Gary Williams's avatar Gary Williams
Browse files

detect debug level and output to stdout

parent 628f679f
No related branches found
No related tags found
No related merge requests found
#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 );
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment