Blob Blame Raw
Index: gdm/common/gdm-log.c
===================================================================
--- gdm/common/gdm-log.c	(revision 6215)
+++ gdm/common/gdm-log.c	(working copy)
@@ -78,10 +78,11 @@ log_level_to_priority_and_prefix (GLogLe
                  * to ensure it is seen in a log */
                 if (syslog_levels & G_LOG_LEVEL_DEBUG) {
                         priority = LOG_WARNING;
+                        prefix = "DEBUG(+)";
                 } else {
                         priority = LOG_DEBUG;
+                        prefix = "DEBUG";
                 }
-                prefix = "DEBUG";
                 break;
         default:
                 priority = LOG_DEBUG;
@@ -169,7 +170,9 @@ gdm_log_set_debug (gboolean debug)
 {
         if (debug) {
                 syslog_levels |= G_LOG_LEVEL_DEBUG;
+                g_debug ("Enabling debugging");
         } else {
+                g_debug ("Disabling debugging");
                 syslog_levels &= ~G_LOG_LEVEL_DEBUG;
         }
 }
Index: gdm/daemon/session-worker-main.c
===================================================================
--- gdm/daemon/session-worker-main.c	(revision 6215)
+++ gdm/daemon/session-worker-main.c	(working copy)
@@ -98,6 +98,8 @@ signal_cb (int      signo,
                  */
                 ret = TRUE;
 
+                gdm_log_toggle_debug ();
+
                 break;
 
         default:
@@ -110,6 +112,17 @@ signal_cb (int      signo,
         return ret;
 }
 
+static gboolean
+is_debug_set (gboolean arg)
+{
+        /* enable debugging for unstable builds */
+        if (gdm_is_version_unstable ()) {
+                return TRUE;
+        }
+
+        return arg;
+}
+
 int
 main (int    argc,
       char **argv)
@@ -119,7 +132,9 @@ main (int    argc,
         GdmSessionWorker *worker;
         GdmSignalHandler *signal_handler;
         const char       *address;
+        static gboolean   debug      = FALSE;
         static GOptionEntry entries []   = {
+                { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
                 { NULL }
         };
 
@@ -138,7 +153,7 @@ main (int    argc,
         g_option_context_free (context);
 
         gdm_log_init ();
-        gdm_log_set_debug (TRUE);
+        gdm_log_set_debug (is_debug_set (debug));
 
         address = g_getenv ("GDM_SESSION_DBUS_ADDRESS");
         if (address == NULL) {
Index: gdm/daemon/xdmcp-chooser-slave-main.c
===================================================================
--- gdm/daemon/xdmcp-chooser-slave-main.c	(revision 6215)
+++ gdm/daemon/xdmcp-chooser-slave-main.c	(working copy)
@@ -116,11 +116,19 @@ signal_cb (int      signo,
 
         case SIGUSR1:
                 g_debug ("Got USR1 signal");
-                /* FIXME:
-                 * Play with log levels or something
-                 */
+                /* we get this from xorg - can't use for anything else */
                 ret = TRUE;
 
+                gdm_log_toggle_debug ();
+
+                break;
+
+        case SIGUSR2:
+                g_debug ("Got USR2 signal");
+                ret = TRUE;
+
+                gdm_log_toggle_debug ();
+
                 break;
 
         default:
@@ -142,6 +150,17 @@ on_slave_stopped (GdmSlave   *slave,
         g_main_loop_quit (main_loop);
 }
 
+static gboolean
+is_debug_set (gboolean arg)
+{
+        /* enable debugging for unstable builds */
+        if (gdm_is_version_unstable ()) {
+                return TRUE;
+        }
+
+        return arg;
+}
+
 int
 main (int    argc,
       char **argv)
@@ -151,8 +170,10 @@ main (int    argc,
         DBusGConnection  *connection;
         GdmSlave         *slave;
         static char      *display_id = NULL;
+        static gboolean   debug      = FALSE;
         GdmSignalHandler *signal_handler;
         static GOptionEntry entries []   = {
+                { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
                 { "display-id", 0, 0, G_OPTION_ARG_STRING, &display_id, N_("Display ID"), N_("id") },
                 { NULL }
         };
@@ -178,7 +199,7 @@ main (int    argc,
 
         gdm_log_init ();
 
-        gdm_log_set_debug (TRUE);
+        gdm_log_set_debug (is_debug_set (debug));
 
         if (display_id == NULL) {
                 g_critical ("No display ID set");
@@ -198,6 +219,7 @@ main (int    argc,
         gdm_signal_handler_add (signal_handler, SIGSEGV, signal_cb, NULL);
         gdm_signal_handler_add (signal_handler, SIGABRT, signal_cb, NULL);
         gdm_signal_handler_add (signal_handler, SIGUSR1, signal_cb, NULL);
+        gdm_signal_handler_add (signal_handler, SIGUSR2, signal_cb, NULL);
 
         slave = gdm_xdmcp_chooser_slave_new (display_id);
         if (slave == NULL) {
Index: gdm/daemon/product-slave-main.c
===================================================================
--- gdm/daemon/product-slave-main.c	(revision 6215)
+++ gdm/daemon/product-slave-main.c	(working copy)
@@ -116,13 +116,19 @@ signal_cb (int      signo,
 
         case SIGUSR1:
                 g_debug ("Got USR1 signal");
-                /* FIXME:
-                 * Play with log levels or something
-                 */
+                /* we get this from xorg - can't use for anything else */
                 ret = TRUE;
 
                 break;
 
+        case SIGUSR2:
+                g_debug ("Got USR2 signal");
+                ret = TRUE;
+
+                gdm_log_toggle_debug ();
+
+                break;
+
         default:
                 g_debug ("Caught unhandled signal %d", signo);
                 ret = TRUE;
@@ -142,6 +148,17 @@ on_slave_stopped (GdmSlave   *slave,
         g_main_loop_quit (main_loop);
 }
 
+static gboolean
+is_debug_set (gboolean arg)
+{
+        /* enable debugging for unstable builds */
+        if (gdm_is_version_unstable ()) {
+                return TRUE;
+        }
+
+        return arg;
+}
+
 int
 main (int    argc,
       char **argv)
@@ -151,8 +168,10 @@ main (int    argc,
         DBusGConnection  *connection;
         GdmSlave         *slave;
         static char      *display_id = NULL;
+        static gboolean   debug      = FALSE;
         GdmSignalHandler *signal_handler;
         static GOptionEntry entries []   = {
+                { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
                 { "display-id", 0, 0, G_OPTION_ARG_STRING, &display_id, N_("Display ID"), N_("id") },
                 { NULL }
         };
@@ -178,7 +197,7 @@ main (int    argc,
 
         gdm_log_init ();
 
-        gdm_log_set_debug (TRUE);
+        gdm_log_set_debug (is_debug_set (debug));
 
         if (display_id == NULL) {
                 g_critical ("No display ID set");
@@ -198,6 +217,7 @@ main (int    argc,
         gdm_signal_handler_add (signal_handler, SIGSEGV, signal_cb, NULL);
         gdm_signal_handler_add (signal_handler, SIGABRT, signal_cb, NULL);
         gdm_signal_handler_add (signal_handler, SIGUSR1, signal_cb, NULL);
+        gdm_signal_handler_add (signal_handler, SIGUSR2, signal_cb, NULL);
 
         slave = gdm_product_slave_new (display_id);
         if (slave == NULL) {
Index: gdm/daemon/simple-slave-main.c
===================================================================
--- gdm/daemon/simple-slave-main.c	(revision 6215)
+++ gdm/daemon/simple-slave-main.c	(working copy)
@@ -118,13 +118,19 @@ signal_cb (int      signo,
 
         case SIGUSR1:
                 g_debug ("Got USR1 signal");
-                /* FIXME:
-                 * Play with log levels or something
-                 */
+                /* we get this from xorg - can't use for anything else */
                 ret = TRUE;
 
                 break;
 
+        case SIGUSR2:
+                g_debug ("Got USR2 signal");
+                ret = TRUE;
+
+                gdm_log_toggle_debug ();
+
+                break;
+
         default:
                 g_debug ("Caught unhandled signal %d", signo);
                 ret = TRUE;
@@ -144,6 +150,17 @@ on_slave_stopped (GdmSlave   *slave,
         g_main_loop_quit (main_loop);
 }
 
+static gboolean
+is_debug_set (gboolean arg)
+{
+        /* enable debugging for unstable builds */
+        if (gdm_is_version_unstable ()) {
+                return TRUE;
+        }
+
+        return arg;
+}
+
 int
 main (int    argc,
       char **argv)
@@ -153,8 +170,10 @@ main (int    argc,
         DBusGConnection  *connection;
         GdmSlave         *slave;
         static char      *display_id = NULL;
+        static gboolean   debug      = FALSE;
         GdmSignalHandler *signal_handler;
         static GOptionEntry entries []   = {
+                { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
                 { "display-id", 0, 0, G_OPTION_ARG_STRING, &display_id, N_("Display ID"), N_("id") },
                 { NULL }
         };
@@ -183,7 +202,7 @@ main (int    argc,
 
         gdm_log_init ();
 
-        gdm_log_set_debug (TRUE);
+        gdm_log_set_debug (is_debug_set (debug));
 
         if (display_id == NULL) {
                 g_critical ("No display ID set");
@@ -208,6 +227,7 @@ main (int    argc,
         gdm_signal_handler_add (signal_handler, SIGSEGV, signal_cb, NULL);
         gdm_signal_handler_add (signal_handler, SIGABRT, signal_cb, NULL);
         gdm_signal_handler_add (signal_handler, SIGUSR1, signal_cb, NULL);
+        gdm_signal_handler_add (signal_handler, SIGUSR2, signal_cb, NULL);
 
         slave = gdm_simple_slave_new (display_id);
         if (slave == NULL) {
Index: gdm/daemon/factory-slave-main.c
===================================================================
--- gdm/daemon/factory-slave-main.c	(revision 6215)
+++ gdm/daemon/factory-slave-main.c	(working copy)
@@ -121,6 +121,8 @@ signal_cb (int      signo,
                  */
                 ret = TRUE;
 
+                gdm_log_toggle_debug ();
+
                 break;
 
         default:
@@ -142,6 +144,17 @@ on_slave_stopped (GdmSlave   *slave,
         g_main_loop_quit (main_loop);
 }
 
+static gboolean
+is_debug_set (gboolean arg)
+{
+        /* enable debugging for unstable builds */
+        if (gdm_is_version_unstable ()) {
+                return TRUE;
+        }
+
+        return arg;
+}
+
 int
 main (int    argc,
       char **argv)
@@ -151,8 +164,10 @@ main (int    argc,
         DBusGConnection  *connection;
         GdmSlave         *slave;
         static char      *display_id = NULL;
+        static gboolean   debug      = FALSE;
         GdmSignalHandler *signal_handler;
         static GOptionEntry entries []   = {
+                { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
                 { "display-id", 0, 0, G_OPTION_ARG_STRING, &display_id, N_("Display ID"), N_("id") },
                 { NULL }
         };
@@ -178,7 +193,7 @@ main (int    argc,
 
         gdm_log_init ();
 
-        gdm_log_set_debug (TRUE);
+        gdm_log_set_debug (is_debug_set (debug));
 
         if (display_id == NULL) {
                 g_critical ("No display ID set");
@@ -198,6 +213,7 @@ main (int    argc,
         gdm_signal_handler_add (signal_handler, SIGSEGV, signal_cb, NULL);
         gdm_signal_handler_add (signal_handler, SIGABRT, signal_cb, NULL);
         gdm_signal_handler_add (signal_handler, SIGUSR1, signal_cb, NULL);
+        gdm_signal_handler_add (signal_handler, SIGUSR2, signal_cb, NULL);
 
         slave = gdm_factory_slave_new (display_id);
         if (slave == NULL) {