[gnome-builder/wip/chergert/multi-process] worker: pass verbosity logging level to subprocesses
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/multi-process] worker: pass verbosity logging level to subprocesses
- Date: Wed, 21 Oct 2015 01:31:19 +0000 (UTC)
commit c9810cd37a5b9fb3365757f9ae79fabcf94a3011
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]