#include "lber.h"
#include "ldap_pvt.h"
-struct DEBUGLEVEL
-{
- char *subsystem;
- int level;
-};
-
int ldap_loglevels[LDAP_SUBSYS_NUM];
static FILE *log_file = NULL;
}
#endif
-static char *lutil_levels[] = {
+static char *debug_levels[] = {
"emergency", "alert", "critical",
"error", "warning", "notice",
"information", "entry", "args",
"results", "detail1", "detail2",
NULL };
-static char *lutil_subsys[LDAP_SUBSYS_NUM] = {
- "GLOBAL","OPERATION", "TRANSPORT",
+static char *debug_subsys[LDAP_SUBSYS_NUM] = {
+ "GLOBAL", "OPERATION", "TRANSPORT",
"CONNECTION", "FILTER", "BER",
"CONFIG", "ACL", "CACHE", "INDEX",
"LDIF", "TOOLS", "SLAPD", "SLURPD",
{
int i;
for( i = 0; i < LDAP_SUBSYS_NUM; i++ ) {
- if ( !strcasecmp( subsys, lutil_subsys[i] ) ) {
+ if ( !strcasecmp( subsys, debug_subsys[i] ) ) {
return i;
}
}
void lutil_set_all_backends( int level )
{
int i;
-
for( i = 0; i < LDAP_SUBSYS_NUM; i++ ) {
- if ( !strncasecmp( "BACK_", lutil_subsys[i], sizeof("BACK_")-1 ) ) {
+ if ( !strncasecmp( "BACK_", debug_subsys[i], sizeof("BACK_")-1 ) ) {
ldap_loglevels[i] = level;
}
}
int lutil_mnem2level( const char *level )
{
int i;
- for( i = 0; lutil_levels[i] != NULL; i++ ) {
- if ( !strcasecmp( level, lutil_levels[i] ) ) {
+ for( i = 0; debug_levels[i] != NULL; i++ ) {
+ if ( !strcasecmp( level, debug_levels[i] ) ) {
return i;
}
}
va_list vl;
va_start( vl, fmt );
ber_get_option( NULL, LBER_OPT_LOG_PRINT_FILE, &outfile );
- lutil_log_int( outfile, lutil_subsys[subsys], level, fmt, vl );
+ lutil_log_int( outfile, debug_subsys[subsys], level, fmt, vl );
va_end( vl );
}
global_level = atoi( optarg );
ldap_loglevels[0] = global_level;
/*
- * if a negative number was used, make the global level the
- * maximum sane level.
- */
+ * if a negative number was used, make the global level the
+ * maximum sane level.
+ */
if ( global_level < 0 ) {
global_level = 65535;
ldap_loglevels[0] = 65535;
ber_set_option( NULL, LBER_OPT_LOG_PRINT_FILE, log_file );
}
#endif
- va_start( vl, fmt );
+ va_start( vl, fmt );
vsnprintf( buffer, sizeof(buffer), fmt, vl );
buffer[sizeof(buffer)-1] = '\0';
-
if( log_file != NULL ) {
fputs( buffer, log_file );
fflush( log_file );
}
-
fputs( buffer, stderr );
va_end( vl );
}