[Spice-devel] [spice-common PATCH v1 3/13] log: Always use Spice domain for glib

Victor Toso victortoso at redhat.com
Fri Dec 11 07:54:49 PST 2015


---
 common/Makefile.am | 1 +
 common/log.c       | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/Makefile.am b/common/Makefile.am
index 7382509..042fa97 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -91,6 +91,7 @@ endif
 
 AM_CPPFLAGS =				\
 	-I$(top_srcdir)			\
+	-DG_LOG_DOMAIN=\"Spice\"	\
 	$(SPICE_COMMON_CFLAGS)		\
 	$(PROTOCOL_CFLAGS)		\
 	$(NULL)
diff --git a/common/log.c b/common/log.c
index fb68708..19a58f0 100644
--- a/common/log.c
+++ b/common/log.c
@@ -85,7 +85,7 @@ static void spice_log_set_abort_level(void)
                     fatal_mask |= glib_abort_level;
                     glib_abort_level >>= 1;
                 }
-                g_log_set_fatal_mask(SPICE_LOG_DOMAIN, fatal_mask);
+                g_log_set_fatal_mask(G_LOG_DOMAIN, fatal_mask);
             }
         } else {
             abort_level = SPICE_ABORT_LEVEL_DEFAULT;
@@ -117,7 +117,8 @@ static void spice_logv(const char *log_domain,
     if (format) {
         g_string_append_vprintf(log_msg, format, args);
     }
-    g_log(log_domain, spice_log_level_to_glib(log_level), "%s", log_msg->str);
+    g_log(G_LOG_DOMAIN, spice_log_level_to_glib(log_level),
+          "[%s] %s", log_domain, log_msg->str);
     g_string_free(log_msg, TRUE);
 
     if (abort_level != -1 && abort_level >= (int) log_level) {
-- 
2.5.0



More information about the Spice-devel mailing list