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>
This commit is contained in:
Jonas Ådahl 2021-11-15 19:42:25 +01:00 committed by Marge Bot
parent cbdd62c197
commit 8c8bbb8008
4 changed files with 17 additions and 35 deletions

View File

@ -881,24 +881,32 @@ meta_workspace_manager_calc_workspace_layout (MetaWorkspaceManager *workspace_ma
#ifdef WITH_VERBOSE_MODE #ifdef WITH_VERBOSE_MODE
if (meta_is_verbose ()) if (meta_is_verbose ())
{ {
g_autoptr (GString) str = NULL;
str = g_string_new ("Workspace layout:");
r = 0; r = 0;
while (r < layout->rows) while (r < layout->rows)
{ {
meta_verbose (" "); g_string_append (str, "\n");
meta_push_no_msg_prefix ();
c = 0; c = 0;
while (c < layout->cols) while (c < layout->cols)
{ {
if (r == layout->current_row && if (r == layout->current_row &&
c == layout->current_col) 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 else
meta_verbose ("%3d ", layout->grid[r*layout->cols+c]); {
g_string_append_printf (str, "%3d ",
layout->grid[r * layout->cols + c]);
}
++c; ++c;
} }
meta_pop_no_msg_prefix ();
++r; ++r;
} }
meta_verbose ("%s", str->str);
} }
#endif /* WITH_VERBOSE_MODE */ #endif /* WITH_VERBOSE_MODE */
} }

View File

@ -231,13 +231,11 @@ stack_dump (MetaStackTracker *tracker,
{ {
guint i; guint i;
meta_push_no_msg_prefix ();
for (i = 0; i < stack->len; i++) for (i = 0; i < stack->len; i++)
{ {
guint64 window = g_array_index (stack, guint64, i); guint64 window = g_array_index (stack, guint64, i);
meta_topic (META_DEBUG_STACK, " %s", get_window_desc (tracker, window)); meta_topic (META_DEBUG_STACK, " %s", get_window_desc (tracker, window));
} }
meta_pop_no_msg_prefix ();
} }
#endif /* WITH_VERBOSE_MODE */ #endif /* WITH_VERBOSE_MODE */
@ -248,7 +246,6 @@ meta_stack_tracker_dump (MetaStackTracker *tracker)
GList *l; GList *l;
meta_topic (META_DEBUG_STACK, "MetaStackTracker state"); 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, " xserver_serial: %ld", tracker->xserver_serial);
meta_topic (META_DEBUG_STACK, " verified_stack: "); meta_topic (META_DEBUG_STACK, " verified_stack: ");
stack_dump (tracker, tracker->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: "); meta_topic (META_DEBUG_STACK, " predicted_stack: ");
stack_dump (tracker, tracker->predicted_stack); stack_dump (tracker, tracker->predicted_stack);
} }
meta_pop_no_msg_prefix ();
#endif /* WITH_VERBOSE_MODE */ #endif /* WITH_VERBOSE_MODE */
} }

View File

@ -86,7 +86,6 @@ on_stack_changed (MetaStack *stack)
hidden_stack_ids = g_array_new (FALSE, FALSE, sizeof (uint64_t)); hidden_stack_ids = g_array_new (FALSE, FALSE, sizeof (uint64_t));
meta_topic (META_DEBUG_STACK, "Bottom to top: "); meta_topic (META_DEBUG_STACK, "Bottom to top: ");
meta_push_no_msg_prefix ();
sorted = meta_stack_list_windows (stack, NULL); 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); g_array_append_val (all_root_children_stacked, stack_id);
} }
meta_pop_no_msg_prefix ();
if (display->x11_display) if (display->x11_display)
{ {
uint64_t guard_window_id; uint64_t guard_window_id;

View File

@ -82,7 +82,6 @@ meta_topic_real_valist (MetaDebugTopic topic,
#endif #endif
static gint verbose_topics = 0; static gint verbose_topics = 0;
static int no_prefix = 0;
static gboolean is_wayland_compositor = FALSE; static gboolean is_wayland_compositor = FALSE;
static int debug_paint_flags = 0; static int debug_paint_flags = 0;
@ -370,8 +369,7 @@ meta_topic_real_valist (MetaDebugTopic topic,
out = logfile ? logfile : stderr; 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) if (topic == META_DEBUG_SYNC)
{ {
@ -419,8 +417,7 @@ meta_bug (const char *format, ...)
out = stderr; out = stderr;
#endif #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 (str, out);
utf8_fputs ("\n", out); utf8_fputs ("\n", out);
@ -451,8 +448,7 @@ meta_warning (const char *format, ...)
out = stderr; out = stderr;
#endif #endif
if (no_prefix == 0) utf8_fputs ("Window manager warning: ", out);
utf8_fputs ("Window manager warning: ", out);
utf8_fputs (str, out); utf8_fputs (str, out);
utf8_fputs ("\n", out); utf8_fputs ("\n", out);
@ -482,8 +478,7 @@ meta_fatal (const char *format, ...)
out = stderr; out = stderr;
#endif #endif
if (no_prefix == 0) utf8_fputs ("Window manager error: ", out);
utf8_fputs ("Window manager error: ", out);
utf8_fputs (str, out); utf8_fputs (str, out);
utf8_fputs ("\n", out); utf8_fputs ("\n", out);
@ -494,20 +489,6 @@ meta_fatal (const char *format, ...)
meta_exit (META_EXIT_ERROR); 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 void
meta_exit (MetaExitCode code) meta_exit (MetaExitCode code)
{ {