From 0354713d350988599c22ff158ac03e48330f4d1a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Enrico=20Tr=C3=B6ger?= Date: Fri, 18 Apr 2008 16:50:15 +0200 Subject: [PATCH] Implement logging error messages from the server to syslog. --- irc.c | 6 ++++++ vomak.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/irc.c b/irc.c index 82917d1..9af92ca 100644 --- a/irc.c +++ b/irc.c @@ -29,6 +29,9 @@ #include #include #include +#ifndef DEBUG +# include +#endif #include @@ -326,6 +329,9 @@ static gboolean process_line(irc_conn_t *irc_conn, const gchar *line, guint len) if (response != 477 || strstr(line, "[freenode-info]") == NULL) { g_print("Error: %s", line); +#ifndef DEBUG + syslog(LOG_WARNING, "received error: %d (%s)", response, g_strstrip((gchar*) line)); +#endif main_quit(); return FALSE; } diff --git a/vomak.c b/vomak.c index 89e78ab..36109d5 100644 --- a/vomak.c +++ b/vomak.c @@ -18,6 +18,7 @@ */ + #define _GNU_SOURCE #include @@ -31,6 +32,9 @@ #include #include #include +#ifndef DEBUG +# include +#endif #include #include @@ -116,6 +120,9 @@ static void signal_cb(gint sig) void main_quit() { +#ifndef DEBUG + closelog(); +#endif irc_finalize(&irc_conn); socket_finalize(&socket_info); @@ -414,6 +421,7 @@ gint main(gint argc, gchar **argv) signal(SIGTTOU, SIG_IGN); signal(SIGTTIN, SIG_IGN); signal(SIGTSTP, SIG_IGN); + openlog("vomak", LOG_PID, LOG_DAEMON); if (daemon(1, 0) < 0) { -- 2.11.4.GIT