[tracker] libtracker-{common|sparql}: Set G_MESSAGES_DEBUG when verbosity > 2



commit a7d9390ea9bae3881f11d5d96425e16b9e710414
Author: Martyn Russell <martyn lanedo com>
Date:   Tue May 1 11:14:56 2012 +0100

    libtracker-{common|sparql}: Set G_MESSAGES_DEBUG when verbosity > 2
    
    Since glib 2.32, debug statements are not shown without this environment
    variable being set.

 src/libtracker-common/tracker-log.c                |    7 +++++++
 src/libtracker-sparql-backend/tracker-backend.vala |    5 +++++
 2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-common/tracker-log.c b/src/libtracker-common/tracker-log.c
index 8334012..f83b598 100644
--- a/src/libtracker-common/tracker-log.c
+++ b/src/libtracker-common/tracker-log.c
@@ -176,6 +176,13 @@ tracker_log_init (gint    this_verbosity,
 		g_free (verbosity_string);
 	}
 
+	/* If we have debug enabled, we imply G_MESSAGES_DEBUG or we
+	 * see nothing, this came in since GLib 2.32.
+	 */
+	if (this_verbosity > 2) {
+		g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
+	}
+
 	basename = g_strdup_printf ("%s.log", g_get_application_name ());
 	filename = g_build_filename (g_get_user_data_dir (),
 	                             "tracker",
diff --git a/src/libtracker-sparql-backend/tracker-backend.vala b/src/libtracker-sparql-backend/tracker-backend.vala
index bb85cce..0b52bd0 100644
--- a/src/libtracker-sparql-backend/tracker-backend.vala
+++ b/src/libtracker-sparql-backend/tracker-backend.vala
@@ -334,6 +334,11 @@ class Tracker.Sparql.Backend : Connection {
 
 		LogLevelFlags remove_levels = 0;
 
+		// If we have debug enabled, we imply G_MESSAGES_DEBUG or we
+		// see nothing, this came in since GLib 2.32.
+		if (verbosity > 2)
+			Environment.set_variable ("G_MESSAGES_DEBUG", "all", true);
+
 		switch (verbosity) {
 		// Log level 3: EVERYTHING
 		case 3:



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