diff --git a/src/core/util.c b/src/core/util.c index ea26bc2f0..fddd06fdd 100644 --- a/src/core/util.c +++ b/src/core/util.c @@ -79,6 +79,7 @@ static const GDebugKey meta_debug_keys[] = { static gint verbose_topics = 0; static gboolean is_wayland_compositor = FALSE; static int debug_paint_flags = 0; +static GLogLevelFlags mutter_log_level = G_LOG_LEVEL_MESSAGE; #ifdef WITH_VERBOSE_MODE static FILE* logfile = NULL; @@ -213,6 +214,9 @@ meta_init_debug_utils (void) G_N_ELEMENTS (meta_debug_keys)); meta_add_verbose_topic (topics); } + + if (g_test_initialized ()) + mutter_log_level = G_LOG_LEVEL_DEBUG; } gboolean @@ -584,3 +588,13 @@ meta_get_debug_paint_flags (void) { return debug_paint_flags; } + +void +meta_log (const char *format, ...) +{ + va_list args; + + va_start (args, format); + g_logv (G_LOG_DOMAIN, mutter_log_level, format, args); + va_end (args); +} diff --git a/src/meta/util.h b/src/meta/util.h index d61fa85d8..bb2e875c1 100644 --- a/src/meta/util.h +++ b/src/meta/util.h @@ -157,6 +157,9 @@ char* meta_g_utf8_strndup (const gchar *src, gsize n); const char * meta_topic_to_string (MetaDebugTopic topic); +META_EXPORT +void meta_log (const char *format, ...) G_GNUC_PRINTF (1, 2); + #define meta_topic(debug_topic, ...) \ G_STMT_START \ { \ @@ -165,7 +168,7 @@ const char * meta_topic_to_string (MetaDebugTopic topic); g_autofree char *_topic_message = NULL; \ \ _topic_message = g_strdup_printf (__VA_ARGS__); \ - g_message ("%s: %s", meta_topic_to_string (debug_topic), \ + meta_log ("%s: %s", meta_topic_to_string (debug_topic), \ _topic_message); \ } \ } \