From b2093e3016027d6b5cf06b3f91f30769bfc099e2 Mon Sep 17 00:00:00 2001 From: cvsadm Date: Fri, 21 Jan 2005 00:44:34 +0000 Subject: Moving NSCP Directory Server from DirectoryBranch to TRUNK, initial drop. (foxworth) --- ldap/libraries/libutil/ntdebug.c | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 ldap/libraries/libutil/ntdebug.c (limited to 'ldap/libraries/libutil/ntdebug.c') diff --git a/ldap/libraries/libutil/ntdebug.c b/ldap/libraries/libutil/ntdebug.c new file mode 100644 index 00000000..d0347e2d --- /dev/null +++ b/ldap/libraries/libutil/ntdebug.c @@ -0,0 +1,51 @@ +/** BEGIN COPYRIGHT BLOCK + * Copyright 2001 Sun Microsystems, Inc. + * Portions copyright 1999, 2001-2003 Netscape Communications Corporation. + * All rights reserved. + * END COPYRIGHT BLOCK **/ +/****************************************************** + * + * ntdebug.c - Sends debug output to window and stdout + * on Win32 platforms. + * + ******************************************************/ + +#if defined( _WIN32 ) +#include +#include +#include +#if defined( SLAPD_LOGGING ) +#include "slap.h" +#include "proto-slap.h" +#else +#include "ldap.h" +#include "ldaplog.h" +#endif +int slapd_ldap_debug = LDAP_DEBUG_ANY; +FILE *error_logfp = NULL; + +void LDAPDebug( int level, char *fmt, ... ) +{ + va_list arg_ptr; + va_start( arg_ptr, fmt ); + if ( slapd_ldap_debug & level ) + { + char szFormattedString[512]; + _vsnprintf( szFormattedString, sizeof( szFormattedString ), fmt, arg_ptr ); + +#if defined( LDAP_DEBUG ) + /* Send to debug window ...*/ + OutputDebugString( szFormattedString ); + + /* ... and to stderr */ + fprintf( stderr, szFormattedString ); +#endif +#if defined( SLAPD_LOGGING ) + if ( error_logfp != NULL ) + slapd_log_error( error_logfp, szFormattedString ); +#endif + } + va_end( arg_ptr ); + +} +#endif -- cgit