[gnome-software/wip/mwleeds/honor-g-messages-debug] WIP




commit d5556daed559f80d69cf254b46854ada94aa65c7
Author: Phaedrus Leeds <mwleeds endlessos org>
Date:   Fri Feb 12 17:55:45 2021 -0800

    WIP

 lib/gs-debug.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/lib/gs-debug.c b/lib/gs-debug.c
index af278495b..8ca5a841b 100644
--- a/lib/gs-debug.c
+++ b/lib/gs-debug.c
@@ -30,17 +30,14 @@ gs_log_writer_console (GLogLevelFlags log_level,
                       gpointer user_data)
 {
        GsDebug *debug = GS_DEBUG (user_data);
+       const gchar *domains = NULL;
+       const gchar *gs_debug = NULL;
        const gchar *log_domain = NULL;
        const gchar *log_message = NULL;
        g_autofree gchar *tmp = NULL;
        g_autoptr(GMutexLocker) locker = NULL;
        g_autoptr(GString) domain = NULL;
 
-       /* enabled */
-       if (g_getenv ("GS_DEBUG") == NULL &&
-           log_level == G_LOG_LEVEL_DEBUG)
-               return G_LOG_WRITER_HANDLED;
-
        /* get data from arguments */
        for (gsize i = 0; i < n_fields; i++) {
                if (g_strcmp0 (fields[i].key, "MESSAGE") == 0) {
@@ -53,6 +50,19 @@ gs_log_writer_console (GLogLevelFlags log_level,
                }
        }
 
+       domains = g_getenv ("G_MESSAGES_DEBUG");
+       gs_debug = g_getenv ("GS_DEBUG");
+
+       /* enabled */
+       if (log_level == G_LOG_LEVEL_DEBUG &&
+           gs_debug == NULL) {
+               if (domains == NULL)
+                       return G_LOG_WRITER_HANDLED;
+
+               if (
+       }
+
+       if (domains != NULL
        /* this is really verbose */
        if ((g_strcmp0 (log_domain, "dconf") == 0 ||
             g_strcmp0 (log_domain, "GLib-GIO") == 0 ||


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