[gnome-software/1756-include-gnome-software-and-dependencies-versions-in-debug-log-output] gs-debug: Print gnome-software and OS version information on verbose log start



commit ff0b77261e49ddc2995be76beb0e62fdbdb61cae
Author: Milan Crha <mcrha redhat com>
Date:   Fri May 13 08:36:30 2022 +0200

    gs-debug: Print gnome-software and OS version information on verbose log start
    
    That will help to get the information from the log, when the user
    forgets to include it in a report.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1756

 lib/gs-debug.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
---
diff --git a/lib/gs-debug.c b/lib/gs-debug.c
index db09700c1..308a868bf 100644
--- a/lib/gs-debug.c
+++ b/lib/gs-debug.c
@@ -12,6 +12,7 @@
 #include <stdio.h>
 #include <unistd.h>
 
+#include "gs-os-release.h"
 #include "gs-debug.h"
 
 struct _GsDebug
@@ -273,5 +274,25 @@ gs_debug_set_verbose (GsDebug  *self,
 {
        g_return_if_fail (GS_IS_DEBUG (self));
 
+       if (!g_atomic_int_get (&self->verbose) == !verbose)
+               return;
+
        g_atomic_int_set (&self->verbose, verbose);
+
+       if (verbose) {
+               GsOsRelease *os_release;
+               g_autoptr(GError) error = NULL;
+
+               g_debug (PACKAGE_NAME " " PACKAGE_VERSION);
+
+               os_release = gs_os_release_new (&error);
+               if (os_release) {
+                       g_debug ("OS: %s; %s",
+                               gs_os_release_get_name (os_release),
+                               gs_os_release_get_version (os_release));
+                       g_clear_object (&os_release);
+               } else {
+                       g_debug ("Failed to get OS Release information: %s", error->message);
+               }
+       }
 }


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