From 1da684d2544026ff425016681d412d36d453204c Mon Sep 17 00:00:00 2001 From: djcb Date: Thu, 19 Jan 2012 19:24:46 +0200 Subject: [PATCH] * disable g_debug in functions that may be called for logging is initialized --- src/mu-log.c | 17 +++++++++-------- src/mu-util.c | 8 ++++---- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/mu-log.c b/src/mu-log.c index cb238607..8e0b9211 100644 --- a/src/mu-log.c +++ b/src/mu-log.c @@ -94,7 +94,7 @@ static void log_handler (const gchar* log_domain, GLogLevelFlags log_level, const gchar* msg) { - if (log_level == G_LOG_LEVEL_DEBUG && !MU_LOG->_debug) + if ((log_level & G_LOG_LEVEL_DEBUG) && !(MU_LOG->_debug)) return; log_write (log_domain ? log_domain : "mu", log_level, msg); @@ -109,12 +109,12 @@ mu_log_init_with_fd (int fd, gboolean doclose, MU_LOG = g_new(MuLog, 1); - MU_LOG->_fd = fd; - MU_LOG->_quiet = quiet; - MU_LOG->_debug = debug; - MU_LOG->_own = doclose; /* if we now own the fd, close it - * in _destroy */ - MU_LOG->_old_log_func = + MU_LOG->_fd = fd; + MU_LOG->_quiet = quiet; + MU_LOG->_debug = debug; + MU_LOG->_own = doclose; /* if we now own the fd, close it + * in _destroy */ + MU_LOG->_old_log_func = g_log_set_default_handler ((GLogFunc)log_handler, NULL); return TRUE; @@ -255,7 +255,8 @@ log_write (const char* domain, GLogLevelFlags level, /* for serious errors, log them to stderr as well */ if (level & G_LOG_LEVEL_ERROR || level & G_LOG_LEVEL_CRITICAL || - level & G_LOG_LEVEL_WARNING) { + level & G_LOG_LEVEL_WARNING || + level & G_LOG_LEVEL_DEBUG) { fputs ("mu: ", stderr); fputs (msg, stderr); fputs ("\n", stderr); diff --git a/src/mu-util.c b/src/mu-util.c index f5f145ec..56ab3a61 100644 --- a/src/mu-util.c +++ b/src/mu-util.c @@ -105,8 +105,8 @@ mu_util_dir_expand (const char *path) /* now resolve any symlinks, .. etc. */ if (realpath (dir, resolved) == NULL) { - g_debug ("%s: could not get realpath for '%s': %s", - __FUNCTION__, dir, strerror(errno)); + /* g_debug ("%s: could not get realpath for '%s': %s", */ + /* __FUNCTION__, dir, strerror(errno)); */ g_free (dir); return NULL; } else @@ -189,12 +189,12 @@ mu_util_check_dir (const gchar* path, gboolean readable, gboolean writeable) mode = F_OK | (readable ? R_OK : 0) | (writeable ? W_OK : 0); if (access (path, mode) != 0) { - g_debug ("Cannot access %s: %s", path, strerror (errno)); + /* g_debug ("Cannot access %s: %s", path, strerror (errno)); */ return FALSE; } if (stat (path, &statbuf) != 0) { - g_debug ("Cannot stat %s: %s", path, strerror (errno)); + /* g_debug ("Cannot stat %s: %s", path, strerror (errno)); */ return FALSE; }