From 59166d745ea23dbd89f80e206e5a284feadb674a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 15 Nov 2021 18:23:59 +0100 Subject: [PATCH] util: Implement meta_topic() using g_message() This will get us things like timestamps. Part-of: --- src/core/util.c | 6 +++--- src/meta/util.h | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/core/util.c b/src/core/util.c index 889ae4937..df03d7faa 100644 --- a/src/core/util.c +++ b/src/core/util.c @@ -274,8 +274,8 @@ meta_verbose_real (const char *format, ...) va_end (args); } -static const char* -topic_name (MetaDebugTopic topic) +const char * +meta_topic_to_string (MetaDebugTopic topic) { switch (topic) { @@ -369,7 +369,7 @@ meta_topic_real_valist (MetaDebugTopic topic, out = logfile ? logfile : stderr; - fprintf (out, "%s: ", topic_name (topic)); + fprintf (out, "%s: ", meta_topic_to_string (topic)); if (topic == META_DEBUG_SYNC) { diff --git a/src/meta/util.h b/src/meta/util.h index d08bba4aa..876840a2d 100644 --- a/src/meta/util.h +++ b/src/meta/util.h @@ -177,6 +177,8 @@ GPid meta_show_dialog (const char *type, /* To disable verbose mode, we make these functions into no-ops */ #ifdef WITH_VERBOSE_MODE +const char * meta_topic_to_string (MetaDebugTopic topic); + #define meta_verbose(...) \ G_STMT_START \ { \ @@ -185,11 +187,13 @@ GPid meta_show_dialog (const char *type, } \ G_STMT_END -#define meta_topic(debug_topic,...) \ +#define meta_topic(debug_topic, ...) \ G_STMT_START \ { \ if (meta_is_topic_enabled (debug_topic)) \ - meta_topic_real (debug_topic, __VA_ARGS__); \ + { \ + g_message (__VA_ARGS__); \ + } \ } \ G_STMT_END