[gnome-keyring] [daemon] Sent output of g_printerr to syslog.



commit 1f225859713c8fae6d5b58e4d61cfe442e93cc8a
Author: Stef Walter <stef memberwebs com>
Date:   Tue Nov 24 16:23:57 2009 +0000

    [daemon] Sent output of g_printerr to syslog.
    
    In order to catch assertion errors better, send the output of
    g_printerr to syslog as well as stderr.

 daemon/gkr-daemon.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gkr-daemon.c b/daemon/gkr-daemon.c
index 7633c68..f673449 100644
--- a/daemon/gkr-daemon.c
+++ b/daemon/gkr-daemon.c
@@ -315,6 +315,14 @@ log_handler (const gchar *log_domain, GLogLevelFlags log_level,
 }
 
 static void
+printerr_handler (const gchar *string)
+{
+	/* Print to syslog and stderr */
+	syslog (LOG_WARNING, "%s", string);
+	fprintf (stderr, "%s", string);
+}
+
+static void
 prepare_logging ()
 {
     GLogLevelFlags flags = G_LOG_FLAG_FATAL | G_LOG_LEVEL_ERROR | 
@@ -328,6 +336,7 @@ prepare_logging ()
     g_log_set_handler ("Gtk", flags, log_handler, NULL);
     g_log_set_handler ("Gnome", flags, log_handler, NULL);
     g_log_set_default_handler (log_handler, NULL);
+    g_set_printerr_handler (printerr_handler);
 }
 
 /* -----------------------------------------------------------------------------



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]