[gnome-builder] worker: pass verbosity logging level to subprocesses



commit 0a3bf3ebf80100e078e50e5c84f4c7372110e017
Author: Christian Hergert <chergert redhat com>
Date:   Tue Oct 20 18:29:17 2015 -0700

    worker: pass verbosity logging level to subprocesses
    
    If we spawn a subprocess, ensure it's logging level matches that of the
    parent process. This is done by passing -v as many times as our parent.
    
    For example, -vvvv gives tracing output.

 libide/ide-worker-process.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/libide/ide-worker-process.c b/libide/ide-worker-process.c
index fd4e6cf..5cef164 100644
--- a/libide/ide-worker-process.c
+++ b/libide/ide-worker-process.c
@@ -23,6 +23,7 @@
 #include "egg-counter.h"
 
 #include "ide-debug.h"
+#include "ide-log.h"
 #include "ide-worker-process.h"
 #include "ide-worker.h"
 
@@ -112,7 +113,10 @@ ide_worker_process_respawn (IdeWorkerProcess *self)
   g_autoptr(GSubprocess) subprocess = NULL;
   g_autofree gchar *type = NULL;
   g_autofree gchar *dbus_address = NULL;
+  g_autoptr(GString) verbosearg = NULL;
   GError *error = NULL;
+  gint verbosity;
+  gint i;
 
   IDE_ENTRY;
 
@@ -122,8 +126,18 @@ ide_worker_process_respawn (IdeWorkerProcess *self)
   type = g_strdup_printf ("--type=%s", self->plugin_name);
   dbus_address = g_strdup_printf ("--dbus-address=%s", self->dbus_address);
 
+  verbosearg = g_string_new ("-");
+  verbosity = ide_log_get_verbosity ();
+  for (i = 0; i < verbosity; i++)
+    g_string_append_c (verbosearg, 'v');
+
   launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
-  subprocess = g_subprocess_launcher_spawn (launcher, &error, self->argv0, type, dbus_address, NULL);
+  subprocess = g_subprocess_launcher_spawn (launcher, &error,
+                                            self->argv0,  /* gnome-builder */
+                                            type,         /* --type= */
+                                            dbus_address, /* --dbus-addres= */
+                                            verbosity > 0 ? verbosearg->str : NULL,
+                                            NULL);
 
   if (subprocess == NULL)
     {


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