tInitial syslog support. - vaccinewars - be a doctor and try to vaccinate the world
(HTM) git clone git://src.adamsgaard.dk/vaccinewars
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 7076fbbbd247a10b36adcfdeb665cc36edfdbbd6
(DIR) parent 8c286f7d44154d5f675e311f7abb98d7aefa19fb
(HTM) Author: Ben Webb <ben@salilab.org>
Date: Fri, 24 May 2002 11:33:03 +0000
Initial syslog support.
Diffstat:
M src/dopewars.c | 14 ++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/src/dopewars.c b/src/dopewars.c
t@@ -42,6 +42,9 @@
#include <errno.h>
#include <glib.h>
#include <stdarg.h>
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
#include "admin.h"
#include "message.h"
#include "nls.h"
t@@ -1469,6 +1472,14 @@ void dopelog(const int loglevel, const LogFlags flags,
g_logv(G_LOG_DOMAIN, 1 << (loglevel + G_LOG_LEVEL_USER_SHIFT), format,
args);
va_end(args);
+
+#ifdef HAVE_SYSLOG_H
+ if (loglevel <= Log.Level) {
+ va_start(args, format);
+ vsyslog(LOG_INFO, format, args);
+ va_end(args);
+ }
+#endif
}
/*
t@@ -2788,6 +2799,9 @@ GString *GetLogString(GLogLevelFlags log_level, const gchar *message)
void OpenLog(void)
{
CloseLog();
+#ifdef HAVE_SYSLOG_H
+ openlog(PACKAGE, LOG_PID, LOG_USER);
+#endif
if (Log.File[0] == '\0')
return;
Log.fp = fopen(Log.File, "a");