* disable g_debug in functions that may be called for logging is initialized
This commit is contained in:
17
src/mu-log.c
17
src/mu-log.c
@ -94,7 +94,7 @@ static void
|
|||||||
log_handler (const gchar* log_domain, GLogLevelFlags log_level,
|
log_handler (const gchar* log_domain, GLogLevelFlags log_level,
|
||||||
const gchar* msg)
|
const gchar* msg)
|
||||||
{
|
{
|
||||||
if (log_level == G_LOG_LEVEL_DEBUG && !MU_LOG->_debug)
|
if ((log_level & G_LOG_LEVEL_DEBUG) && !(MU_LOG->_debug))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
log_write (log_domain ? log_domain : "mu", log_level, msg);
|
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 = g_new(MuLog, 1);
|
||||||
|
|
||||||
MU_LOG->_fd = fd;
|
MU_LOG->_fd = fd;
|
||||||
MU_LOG->_quiet = quiet;
|
MU_LOG->_quiet = quiet;
|
||||||
MU_LOG->_debug = debug;
|
MU_LOG->_debug = debug;
|
||||||
MU_LOG->_own = doclose; /* if we now own the fd, close it
|
MU_LOG->_own = doclose; /* if we now own the fd, close it
|
||||||
* in _destroy */
|
* in _destroy */
|
||||||
MU_LOG->_old_log_func =
|
MU_LOG->_old_log_func =
|
||||||
g_log_set_default_handler ((GLogFunc)log_handler, NULL);
|
g_log_set_default_handler ((GLogFunc)log_handler, NULL);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -255,7 +255,8 @@ log_write (const char* domain, GLogLevelFlags level,
|
|||||||
/* for serious errors, log them to stderr as well */
|
/* for serious errors, log them to stderr as well */
|
||||||
if (level & G_LOG_LEVEL_ERROR ||
|
if (level & G_LOG_LEVEL_ERROR ||
|
||||||
level & G_LOG_LEVEL_CRITICAL ||
|
level & G_LOG_LEVEL_CRITICAL ||
|
||||||
level & G_LOG_LEVEL_WARNING) {
|
level & G_LOG_LEVEL_WARNING ||
|
||||||
|
level & G_LOG_LEVEL_DEBUG) {
|
||||||
fputs ("mu: ", stderr);
|
fputs ("mu: ", stderr);
|
||||||
fputs (msg, stderr);
|
fputs (msg, stderr);
|
||||||
fputs ("\n", stderr);
|
fputs ("\n", stderr);
|
||||||
|
|||||||
@ -105,8 +105,8 @@ mu_util_dir_expand (const char *path)
|
|||||||
|
|
||||||
/* now resolve any symlinks, .. etc. */
|
/* now resolve any symlinks, .. etc. */
|
||||||
if (realpath (dir, resolved) == NULL) {
|
if (realpath (dir, resolved) == NULL) {
|
||||||
g_debug ("%s: could not get realpath for '%s': %s",
|
/* g_debug ("%s: could not get realpath for '%s': %s", */
|
||||||
__FUNCTION__, dir, strerror(errno));
|
/* __FUNCTION__, dir, strerror(errno)); */
|
||||||
g_free (dir);
|
g_free (dir);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else
|
} 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);
|
mode = F_OK | (readable ? R_OK : 0) | (writeable ? W_OK : 0);
|
||||||
|
|
||||||
if (access (path, mode) != 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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stat (path, &statbuf) != 0) {
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user