From 33846e5122fbf8a964f278eb01ad821e643bb63c Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 10 Jun 2008 00:10:04 +0000 Subject: Add syslog logging --- plugin/plugin.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'plugin/plugin.c') diff --git a/plugin/plugin.c b/plugin/plugin.c index c34294a..54144ba 100644 --- a/plugin/plugin.c +++ b/plugin/plugin.c @@ -11,6 +11,9 @@ #include #include #include +#ifdef WITH_SYSLOG +#include +#endif #define WHITESPACE " \t\r\n\v" @@ -35,8 +38,10 @@ log_msg_va (int level, const char* msg, va_list ap) buf[len] = '\n'; buf[len + 1] = '\0'; -#if _DEBUG - fprintf (stderr, "%s", buf); + fprintf (stderr, "%s: %s", PLUGIN_NAME, buf); +#ifdef WITH_SYSLOG + if (level != SLAPI_LOG_TRACE) + syslog (LOG_WARNING | LOG_DAEMON, "%s: %s", PLUGIN_NAME, buf); #endif slapi_log_error (level, PLUGIN_NAME, buf); } @@ -54,8 +59,8 @@ log_msg (int level, const char* msg, ...) void log_trace (const char *where, int line, const char *msg) { - log_msg (SLAPI_LOG_TRACE, "*** %s *** %s:%d %s%s", - PLUGIN_NAME, where, line, msg ? ": " : "", msg ? msg : ""); + log_msg (SLAPI_LOG_TRACE, " *** %s:%d %s%s", + where, line, msg ? ": " : "", msg ? msg : ""); } #endif -- cgit v1.2.3