summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index e0f43df..eddd8ad 100644
--- a/src/util.c
+++ b/src/util.c
@@ -167,6 +167,48 @@ meta_verbose (const char *format, ...)
g_free (str);
}
+static const char*
+topic_name (MetaDebugTopic topic)
+{
+ switch (topic)
+ {
+ case META_DEBUG_FOCUS:
+ return "FOCUS";
+ break;
+ }
+
+ return "Window manager";
+}
+
+void
+meta_topic (MetaDebugTopic topic,
+ const char *format,
+ ...)
+{
+ va_list args;
+ gchar *str;
+ FILE *out;
+
+ g_return_if_fail (format != NULL);
+
+ if (!is_verbose)
+ return;
+
+ va_start (args, format);
+ str = g_strdup_vprintf (format, args);
+ va_end (args);
+
+ out = logfile ? logfile : stderr;
+
+ if (no_prefix == 0)
+ fprintf (out, "%s: ", topic_name (topic));
+ fputs (str, out);
+
+ fflush (out);
+
+ g_free (str);
+}
+
void
meta_bug (const char *format, ...)
{