2 * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
11 #include <ac/stdarg.h>
12 #include <ac/string.h>
17 extern BER_LOG_PRINT_FN lber_log_print;
23 static int ldap_log_check( LDAP *ld, int loglvl )
30 errlvl = ld->ld_errno;
33 return errlvl & loglvl ? 1 : 0;
38 ( LDAP *ld, int loglvl, char *fmt, ... )
56 errlvl = va_arg( ap, LD * );
57 loglvl = va_arg( ap, int );
58 fmt = va_arg( ap, char * );
61 if ( !ldap_log_check( ld, loglvl )) {
66 buf[sizeof(buf) - 1] = '\0';
67 vsnprintf( buf, sizeof(buf)-1, fmt, ap );
69 vsprintf( buf, fmt, ap ); /* hope it's not too long */
72 chokeme = "choke me! I don't have a doprnt manual handy!";
77 (*lber_log_print)( buf );
81 static int lber_log_puts(int errlvl, int loglvl, char *buf)
83 if ( !ldap_log_check( errlvl, loglvl )) {
87 (*lber_log_print)( buf );