[grilo] log: Fix up GRL_DEBUG environment variable
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] log: Fix up GRL_DEBUG environment variable
- Date: Thu, 26 Apr 2012 17:42:46 +0000 (UTC)
commit 8d94c03a445f77db717637ab5c6f2502114860d5
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Thu Apr 26 17:34:14 2012 +0000
log: Fix up GRL_DEBUG environment variable
Grilo relies on the default GLib log handler.
Due to the G_MESSAGES_DEBUG change in GLib, the default handler filters out all
the messages unless G_MESSAGES_DEBUG environment variable includes the log
domain to show ('all' for all domains).
To fix it, if GRL_DEBUG is set, Grilo log domain is added to the
G_MESSAGES_DEBUG so the messages are not filtered.
Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>
src/grl-log.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/grl-log.c b/src/grl-log.c
index 3033385..341b789 100644
--- a/src/grl-log.c
+++ b/src/grl-log.c
@@ -318,6 +318,8 @@ void
_grl_log_init_core_domains (void)
{
const gchar *log_env;
+ const gchar *messages_env;
+ gchar *new_messages_env;
DOMAIN_INIT (GRL_LOG_DOMAIN_DEFAULT, "");
DOMAIN_INIT (log_log_domain, "log");
@@ -337,6 +339,17 @@ _grl_log_init_core_domains (void)
* verbosity */
log_env = g_getenv ("GRL_DEBUG");
if (log_env) {
+ /* Add Grilo log domain to G_MESSAGES_DEBUG, so the messages are not
+ filtered by the default handler */
+ messages_env = g_getenv ("G_MESSAGES_DEBUG");
+ if (!messages_env) {
+ g_setenv ("G_MESSAGES_DEBUG", G_LOG_DOMAIN, FALSE);
+ } else if (g_strcmp0 (messages_env, "all") != 0) {
+ new_messages_env = g_strconcat (messages_env, ":" G_LOG_DOMAIN, NULL);
+ g_setenv ("G_MESSAGES_DEBUG", new_messages_env, TRUE);
+ g_free (new_messages_env);
+ }
+
GRL_LOG (log_log_domain, GRL_LOG_LEVEL_DEBUG,
"Using log configuration from GRL_DEBUG: %s", log_env);
configure_log_domains (log_env);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]