* disable g_debug in functions that may be called for logging is initialized

This commit is contained in:
djcb 2012-01-19 19:24:46 +02:00
parent 9d84138a73
commit 1da684d254
2 changed files with 13 additions and 12 deletions

View File

@ -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);

View File

@ -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;
}