From 79c0562abc6785ceabd2e0e312afbf58251651e5 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Mon, 25 Nov 2013 00:22:33 +0100 Subject: [PATCH] Add log domain to console log messages --- wmud/Makefile.am | 2 +- wmud/main.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/wmud/Makefile.am b/wmud/Makefile.am index a3cefe5..830f553 100644 --- a/wmud/Makefile.am +++ b/wmud/Makefile.am @@ -1,5 +1,5 @@ bin_PROGRAMS = wmud -AM_CPPFLAGS = -DWMUD_STATEDIR=\""$(localstatedir)"\" -DWMUD_CONFDIR=\""$(sysconfdir)"\" $(MEMCACHED_CFLAGS) $(GLIB_CFLAGS) $(GIO_CFLAGS) $(GTHREAD_CFLAGS) $(GDA_CFLAGS) $(CURL_CFLAGS) +AM_CPPFLAGS = -DWMUD_STATEDIR=\""$(localstatedir)"\" -DWMUD_CONFDIR=\""$(sysconfdir)"\" -DG_LOG_DOMAIN=\""wMUD"\" $(MEMCACHED_CFLAGS) $(GLIB_CFLAGS) $(GIO_CFLAGS) $(GTHREAD_CFLAGS) $(GDA_CFLAGS) $(CURL_CFLAGS) wmud_SOURCES = \ main.c \ diff --git a/wmud/main.c b/wmud/main.c index 467ee45..3c224af 100644 --- a/wmud/main.c +++ b/wmud/main.c @@ -140,25 +140,25 @@ wmud_logger(const gchar *log_domain, GLogLevelFlags log_level, const gchar *mess switch (log_level) { case G_LOG_LEVEL_DEBUG: - g_print("[%s] DEBUG: %s\n", timestamp, message); + g_print("[%s] [%s] DEBUG: %s\n", log_domain, timestamp, message); #ifndef DEBUG g_warning("Logging a debug-level message without debugging support!"); #endif break; case G_LOG_LEVEL_MESSAGE: - g_print("[%s] MESSAGE: %s\n", timestamp, message); + g_print("[%s] [%s] MESSAGE: %s\n", log_domain, timestamp, message); break; case G_LOG_LEVEL_INFO: - g_print("[%s] INFO: %s\n", timestamp, message); + g_print("[%s] [%s] INFO: %s\n", log_domain, timestamp, message); break; case G_LOG_LEVEL_WARNING: - g_print("[%s] WARNING: %s\n", timestamp, message); + g_print("[%s] [%s] WARNING: %s\n", log_domain, timestamp, message); break; case G_LOG_LEVEL_CRITICAL: - g_print("[%s] CRITICAL: %s\n", timestamp, message); + g_print("[%s] [%s] CRITICAL: %s\n", log_domain, timestamp, message); break; default: - g_print("[%s] UNKNOWN LEVEL %03d: %s\n", timestamp, log_level, message); + g_print("[%s] [%s] UNKNOWN LEVEL %03d: %s\n", log_domain, timestamp, log_level, message); break; } }