[mutter] util: Remove push/pop no msg prefix logging



commit 8c8bbb8008b90c6f6988072dddfb539731919723
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Mon Nov 15 19:42:25 2021 +0100

    util: Remove push/pop no msg prefix logging
    
    Used to log multiple line entries. Just make continue prefix things, no
    need to mess with maybe-prefixing; it'll just complicate using some less
    custom logging functionality.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2094>

 src/core/meta-workspace-manager.c | 18 +++++++++++++-----
 src/core/stack-tracker.c          |  4 ----
 src/core/stack.c                  |  3 ---
 src/core/util.c                   | 27 ++++-----------------------
 4 files changed, 17 insertions(+), 35 deletions(-)
---
diff --git a/src/core/meta-workspace-manager.c b/src/core/meta-workspace-manager.c
index 61fbc00903..0279ab23d6 100644
--- a/src/core/meta-workspace-manager.c
+++ b/src/core/meta-workspace-manager.c
@@ -881,24 +881,32 @@ meta_workspace_manager_calc_workspace_layout (MetaWorkspaceManager *workspace_ma
 #ifdef WITH_VERBOSE_MODE
   if (meta_is_verbose ())
     {
+      g_autoptr (GString) str = NULL;
+
+      str = g_string_new ("Workspace layout:");
       r = 0;
       while (r < layout->rows)
         {
-          meta_verbose (" ");
-          meta_push_no_msg_prefix ();
+          g_string_append (str, "\n");
           c = 0;
           while (c < layout->cols)
             {
               if (r == layout->current_row &&
                   c == layout->current_col)
-                meta_verbose ("*%2d ", layout->grid[r*layout->cols+c]);
+                {
+                  g_string_append_printf (str, "*%2d ",
+                                          layout->grid[r * layout->cols + c]);
+                }
               else
-                meta_verbose ("%3d ", layout->grid[r*layout->cols+c]);
+                {
+                  g_string_append_printf (str, "%3d ",
+                                          layout->grid[r * layout->cols + c]);
+                }
               ++c;
             }
-          meta_pop_no_msg_prefix ();
           ++r;
         }
+      meta_verbose ("%s", str->str);
     }
 #endif /* WITH_VERBOSE_MODE */
 }
diff --git a/src/core/stack-tracker.c b/src/core/stack-tracker.c
index fbfef64653..9c217a08ca 100644
--- a/src/core/stack-tracker.c
+++ b/src/core/stack-tracker.c
@@ -231,13 +231,11 @@ stack_dump (MetaStackTracker *tracker,
 {
   guint i;
 
-  meta_push_no_msg_prefix ();
   for (i = 0; i < stack->len; i++)
     {
       guint64 window = g_array_index (stack, guint64, i);
       meta_topic (META_DEBUG_STACK, "    %s", get_window_desc (tracker, window));
     }
-  meta_pop_no_msg_prefix ();
 }
 #endif /* WITH_VERBOSE_MODE */
 
@@ -248,7 +246,6 @@ meta_stack_tracker_dump (MetaStackTracker *tracker)
   GList *l;
 
   meta_topic (META_DEBUG_STACK, "MetaStackTracker state");
-  meta_push_no_msg_prefix ();
   meta_topic (META_DEBUG_STACK, "  xserver_serial: %ld", tracker->xserver_serial);
   meta_topic (META_DEBUG_STACK, "  verified_stack: ");
   stack_dump (tracker, tracker->verified_stack);
@@ -264,7 +261,6 @@ meta_stack_tracker_dump (MetaStackTracker *tracker)
       meta_topic (META_DEBUG_STACK, "  predicted_stack: ");
       stack_dump (tracker, tracker->predicted_stack);
     }
-  meta_pop_no_msg_prefix ();
 #endif /* WITH_VERBOSE_MODE */
 }
 
diff --git a/src/core/stack.c b/src/core/stack.c
index 95223e48e4..645328dd9e 100644
--- a/src/core/stack.c
+++ b/src/core/stack.c
@@ -86,7 +86,6 @@ on_stack_changed (MetaStack *stack)
   hidden_stack_ids = g_array_new (FALSE, FALSE, sizeof (uint64_t));
 
   meta_topic (META_DEBUG_STACK, "Bottom to top: ");
-  meta_push_no_msg_prefix ();
 
   sorted = meta_stack_list_windows (stack, NULL);
 
@@ -124,8 +123,6 @@ on_stack_changed (MetaStack *stack)
       g_array_append_val (all_root_children_stacked, stack_id);
     }
 
-  meta_pop_no_msg_prefix ();
-
   if (display->x11_display)
     {
       uint64_t guard_window_id;
diff --git a/src/core/util.c b/src/core/util.c
index 3133a072c6..889ae4937a 100644
--- a/src/core/util.c
+++ b/src/core/util.c
@@ -82,7 +82,6 @@ meta_topic_real_valist (MetaDebugTopic topic,
 #endif
 
 static gint verbose_topics = 0;
-static int no_prefix = 0;
 static gboolean is_wayland_compositor = FALSE;
 static int debug_paint_flags = 0;
 
@@ -370,8 +369,7 @@ meta_topic_real_valist (MetaDebugTopic topic,
 
   out = logfile ? logfile : stderr;
 
-  if (no_prefix == 0)
-    fprintf (out, "%s: ", topic_name (topic));
+  fprintf (out, "%s: ", topic_name (topic));
 
   if (topic == META_DEBUG_SYNC)
     {
@@ -419,8 +417,7 @@ meta_bug (const char *format, ...)
   out = stderr;
 #endif
 
-  if (no_prefix == 0)
-    utf8_fputs ("Bug in window manager: ", out);
+  utf8_fputs ("Bug in window manager: ", out);
   utf8_fputs (str, out);
   utf8_fputs ("\n", out);
 
@@ -451,8 +448,7 @@ meta_warning (const char *format, ...)
   out = stderr;
 #endif
 
-  if (no_prefix == 0)
-    utf8_fputs ("Window manager warning: ", out);
+  utf8_fputs ("Window manager warning: ", out);
   utf8_fputs (str, out);
   utf8_fputs ("\n", out);
 
@@ -482,8 +478,7 @@ meta_fatal (const char *format, ...)
   out = stderr;
 #endif
 
-  if (no_prefix == 0)
-    utf8_fputs ("Window manager error: ", out);
+  utf8_fputs ("Window manager error: ", out);
   utf8_fputs (str, out);
   utf8_fputs ("\n", out);
 
@@ -494,20 +489,6 @@ meta_fatal (const char *format, ...)
   meta_exit (META_EXIT_ERROR);
 }
 
-void
-meta_push_no_msg_prefix (void)
-{
-  ++no_prefix;
-}
-
-void
-meta_pop_no_msg_prefix (void)
-{
-  g_return_if_fail (no_prefix > 0);
-
-  --no_prefix;
-}
-
 void
 meta_exit (MetaExitCode code)
 {


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