[gjs] log only error messages if GJS_DEBUG_OUTPUT is unset.



commit 1b26ca6f20bf798969d7ea2d300890d9153cd99e
Author: Havoc Pennington <hp pobox com>
Date:   Tue May 5 17:01:27 2009 -0400

    log only error messages if GJS_DEBUG_OUTPUT is unset.
---
 util/log.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/util/log.c b/util/log.c
index 846fe86..3b68d8e 100644
--- a/util/log.c
+++ b/util/log.c
@@ -99,6 +99,7 @@ gjs_debug(GjsDebugTopic topic,
           ...)
 {
     static FILE *logfp = NULL;
+    static gboolean debug_log_enabled = FALSE;
     static gboolean strace_timestamps = FALSE;
     static gboolean checked_for_timestamp = FALSE;
     static gboolean print_timestamp = FALSE;
@@ -146,6 +147,8 @@ gjs_debug(GjsDebugTopic topic,
                         log_file, g_strerror(errno));
 
             g_free(free_me);
+
+            debug_log_enabled = TRUE;
         }
 
         if (logfp == NULL)
@@ -154,6 +157,14 @@ gjs_debug(GjsDebugTopic topic,
         strace_timestamps = gjs_environment_variable_is_set("GJS_STRACE_TIMESTAMPS");
     }
 
+    /* only log errors and strace timestamps if debug
+     * log wasn't specifically switched on
+     */
+    if ((!debug_log_enabled) &&
+        !(topic == GJS_DEBUG_ERROR ||
+          topic == GJS_DEBUG_STRACE_TIMESTAMP))
+        return;
+
     error = FALSE;
     prefix = "???";
     switch (topic) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]