2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 1998-2012 The OpenLDAP Foundation.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted only as authorized by the OpenLDAP
11 * A copy of this license is available in the file LICENSE in the
12 * top-level directory of the distribution or, alternatively, at
13 * <http://www.OpenLDAP.org/license.html>.
21 #include <ac/stdarg.h>
22 #include <ac/string.h>
31 static int ldap_log_check( LDAP *ld, int loglvl )
38 errlvl = ld->ld_debug;
41 return errlvl & loglvl ? 1 : 0;
44 int ldap_log_printf( LDAP *ld, int loglvl, const char *fmt, ... )
49 if ( !ldap_log_check( ld, loglvl )) {
55 buf[sizeof(buf) - 1] = '\0';
56 vsnprintf( buf, sizeof(buf)-1, fmt, ap );
60 (*ber_pvt_log_print)( buf );