[tracker/sam/tracker-2.3-developer-experience: 5/38] Enable G_MESSAGES_DEBUG=Tracker rather than G_MESSAGES_DEBUG=all
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/sam/tracker-2.3-developer-experience: 5/38] Enable G_MESSAGES_DEBUG=Tracker rather than G_MESSAGES_DEBUG=all
- Date: Wed, 2 Oct 2019 20:17:44 +0000 (UTC)
commit 6c456f1309376cd01cb7e0261add980ccffaf113
Author: Sam Thursfield <sam afuera me uk>
Date: Thu Aug 29 19:03:37 2019 +0300
Enable G_MESSAGES_DEBUG=Tracker rather than G_MESSAGES_DEBUG=all
In order for our g_info()/g_message()/g_debug() log messages to be
handled, we need to have G_MESSAGES_DEBUG=Tracker enabled in the
environment. Previously we would enable G_MESSAGES_DEBUG=all, which
has the effect of also enabling log output from GLib/GIO and other
dependencies.
In the interests of keeping logs clean, we now require the user to
explicitly set G_MESSAGES_DEBUG=all if they want maximum debug output.
src/libtracker-common/tracker-log.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-common/tracker-log.c b/src/libtracker-common/tracker-log.c
index d300ee795..f3228516e 100644
--- a/src/libtracker-common/tracker-log.c
+++ b/src/libtracker-common/tracker-log.c
@@ -151,6 +151,18 @@ hide_log_handler (const gchar *domain,
/* do nothing */
}
+static void
+ensure_g_messages_debug_set ()
+{
+ const gchar *value;
+
+ value = g_getenv ("G_MESSAGES_DEBUG");
+
+ if (value == NULL) {
+ g_setenv ("G_MESSAGES_DEBUG", "Tracker", TRUE);
+ }
+}
+
gboolean
tracker_log_init (gint this_verbosity,
gchar **used_filename)
@@ -192,8 +204,8 @@ tracker_log_init (gint this_verbosity,
/* If we have debug enabled, we imply G_MESSAGES_DEBUG or we
* see nothing, this came in since GLib 2.32.
*/
- if (this_verbosity > 1) {
- g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
+ if (this_verbosity > 0) {
+ ensure_g_messages_debug_set ();
}
if (use_log_files) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]