Now issuing a warning if we are logging a debug message in non-debug mode

This commit is contained in:
Gergely Polonkai 2013-01-02 02:08:06 +01:00
parent 8cf82c0d8c
commit 8402455a87

View File

@ -103,6 +103,7 @@ debug_context(char *file, int line)
debug_context_loc.file = g_strdup(file); debug_context_loc.file = g_strdup(file);
debug_context_loc.line = line; debug_context_loc.line = line;
} }
/** /**
* DebugContext: * DebugContext:
* *
@ -127,14 +128,11 @@ wmud_type_init(void)
void void
wmud_logger(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) wmud_logger(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
{ {
switch (log_level) switch (log_level) {
{
case G_LOG_LEVEL_DEBUG: case G_LOG_LEVEL_DEBUG:
/* Log debug messages only if we are compiled with
* debug support. The code below actually doesn't
* require it, it's just a conceptional thing. */
#ifdef DEBUG
g_print("DEBUG: %s\n", message); g_print("DEBUG: %s\n", message);
#ifndef DEBUG
g_warn("Logging a debug-level message without debugging support!");
#endif #endif
break; break;
case G_LOG_LEVEL_MESSAGE: case G_LOG_LEVEL_MESSAGE: