]> git.sur5r.net Git - openldap/commitdiff
Fleshed out debug2syslog
authorHoward Chu <hyc@openldap.org>
Fri, 10 May 2002 17:48:54 +0000 (17:48 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 10 May 2002 17:48:54 +0000 (17:48 +0000)
libraries/liblutil/debug.c

index 6cebce7da93b87b62589ced587b7fae7f82dd306..1d47361d8e53adca94a876b002583d017f21a518 100644 (file)
 #include <ac/string.h>
 #include <ac/time.h>
 
+#ifdef LDAP_SYSLOG
+#include <ac/syslog.h>
+#endif
+
 #include "ldap_log.h"
 #include "ldap_defaults.h"
 #include "lber.h"
@@ -29,19 +33,22 @@ static long   numLevels = 0;
 static FILE *log_file = NULL;
 static int global_level = 0;
 
-#if 0
 #ifdef LDAP_SYSLOG
 static int use_syslog = 0;
 
 static int debug2syslog(int l) {
        switch (l) {
-       /* insert mapping cases here */
-       default:
+       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
+       return LOG_DEBUG;
 }
 #endif
-#endif
 
 static char *lutil_levels[] = {"emergency", "alert", "critical",
                           "error", "warning", "notice",
@@ -142,7 +149,6 @@ void lutil_log_int(
                return;
        }
 
-#if 0
 #ifdef LDAP_SYSLOG
        /* we're configured to use syslog */
        if( use_syslog ) {
@@ -150,7 +156,6 @@ void lutil_log_int(
                return;
        }
 #endif
-#endif
 
 #if 0
 #ifdef HAVE_WINSOCK