util: Implement meta_topic() using g_message()

This will get us things like timestamps.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2094>
This commit is contained in:
Jonas Ådahl 2021-11-15 18:23:59 +01:00 committed by Marge Bot
parent 8c8bbb8008
commit 59166d745e
2 changed files with 9 additions and 5 deletions

View File

@ -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)
{

View File

@ -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 \
{ \
@ -189,7 +191,9 @@ GPid meta_show_dialog (const char *type,
G_STMT_START \
{ \
if (meta_is_topic_enabled (debug_topic)) \
meta_topic_real (debug_topic, __VA_ARGS__); \
{ \
g_message (__VA_ARGS__); \
} \
} \
G_STMT_END