Fix g_log issue when configured with --enable-debug=no.
authorSamuel Tesla <stesla@engineyard.com>
Thu, 23 Apr 2009 14:46:51 -0500
changeset 599 7207d1dbb86b
parent 598 fcb6e3dfa892
child 600 7f0be2600f6d
Fix g_log issue when configured with --enable-debug=no.
loudmouth/lm-debug.c
--- a/loudmouth/lm-debug.c	Thu Apr 23 13:20:23 2009 -0500
+++ b/loudmouth/lm-debug.c	Thu Apr 23 14:46:51 2009 -0500
@@ -48,14 +48,14 @@
         }
         else if (log_level & LM_LOG_LEVEL_PARSER) {
             g_print ("LM-PARSER: ");
-        } 
+        }
         else if (log_level & LM_LOG_LEVEL_SASL) {
             g_print ("LM-SASL: ");
         }
         else if (log_level & LM_LOG_LEVEL_SSL) {
             g_print ("LM-SSL: ");
         }
-    
+
         g_print ("%s", message);
     }
 }
@@ -65,7 +65,7 @@
  *
  * Initialized the debug system.
  **/
-void 
+void
 lm_debug_init (void)
 {
     const gchar *env_lm_debug;
@@ -73,14 +73,14 @@
     if (initialized) {
         return;
     }
-    
+
     env_lm_debug = g_getenv ("LM_DEBUG");
     if (env_lm_debug) {
         debug_flags = g_parse_debug_string (env_lm_debug, debug_keys,
                                             NUM_DEBUG_KEYS);
     }
 
-    g_log_set_handler (LM_LOG_DOMAIN, LM_LOG_LEVEL_ALL, 
+    g_log_set_handler (LM_LOG_DOMAIN, LM_LOG_LEVEL_ALL,
                        debug_log_handler, NULL);
 
     initialized = TRUE;
@@ -88,9 +88,19 @@
 
 #else  /* LM_NO_DEBUG */
 
-void 
+static void
+do_nothing_log_handler (const gchar    *log_domain,
+                        GLogLevelFlags  log_level,
+                        const gchar    *message,
+                        gpointer        user_data)
+{
+}
+
+void
 lm_debug_init (void)
 {
+    g_log_set_handler (LM_LOG_DOMAIN, LM_LOG_LEVEL_ALL,
+                       do_nothing_log_handler, NULL);
 }
 
 #endif /* LM_NO_DEBUG */