From 9979d200db438c57bd4066af4df8eb813c545708 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 10 May 2002 17:48:54 +0000 Subject: [PATCH] Fleshed out debug2syslog --- libraries/liblutil/debug.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/libraries/liblutil/debug.c b/libraries/liblutil/debug.c index 6cebce7da9..1d47361d8e 100644 --- a/libraries/liblutil/debug.c +++ b/libraries/liblutil/debug.c @@ -13,6 +13,10 @@ #include #include +#ifdef LDAP_SYSLOG +#include +#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 -- 2.39.5