-static int global_level = 0;
-
-#ifdef LDAP_SYSLOG
-static int use_syslog = 0;
-
-static int debug2syslog(int l) {
- switch (l) {
- case LDAP_LEVEL_EMERG: return LOG_EMERG;
- case LDAP_LEVEL_ALERT: return LOG_ALERT;
- case LDAP_LEVEL_CRIT: return LOG_CRIT;
- case LDAP_LEVEL_ERR: return LOG_ERR;
- case LDAP_LEVEL_WARNING: return LOG_WARNING;
- case LDAP_LEVEL_NOTICE: return LOG_NOTICE;
- case LDAP_LEVEL_INFO: return LOG_INFO;
- }
- return LOG_DEBUG;
-}
-#endif
-
-static char *lutil_levels[] = {"emergency", "alert", "critical",
- "error", "warning", "notice",
- "information", "entry", "args",
- "results", "detail1", "detail2",
- NULL};
-
-static char *lutil_subsys[LDAP_SUBSYS_NUM] = {"global","operation", "transport",
- "connection", "filter", "ber",
- "config", "acl", "cache", "index",
- "ldif", "tools", "slapd", "slurpd",
- "backend", "back_bdb", "back_ldbm",
- "back_ldap", "back_meta", "back_mon" };
-
-int lutil_mnem2subsys( const char *subsys )
-{
- int i;
- for( i = 0; i < LDAP_SUBSYS_NUM; i++ )
- {
- if ( !strcasecmp( subsys, lutil_subsys[i] ) )
- {
- return i;
- }
- }
- return -1;
-}
-
-void lutil_set_all_backends( level )
-{
- int i;
-
- for( i = 0; i < LDAP_SUBSYS_NUM; i++ )
- {
- if ( !strncasecmp( "back_", lutil_subsys[i], strlen("back_") ) )
- {
- 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] ) )
- {
- return i;
- }
- }
- return -1;
-}
-
-static int addSubsys( const char *subsys, int level )
-{
- int subsys_num;
-
- if ( !strcasecmp( subsys, "backend" ) )
- {
- lutil_set_all_backends( level );
- return level;
- }
- else
- {
- subsys_num = lutil_mnem2subsys(subsys);
- if(subsys_num < 0)
- {
- fprintf(stderr, "Unknown Subsystem name [ %s ] - Discarded\n",
- subsys);
- fflush(stderr);
- return -1;
- }
-
- ldap_loglevels[subsys_num] = level;
- return level;
- }
- return -1;
-}
-
-int lutil_set_debug_level( const char* subsys, int level )
-{
- return( addSubsys( subsys, level ) );
-}