changeset 1616:4c7104ec5f3b

Add 2 debugging levels (for 'tracelog_level')
author Mikael Berthe <mikael@lilotux.net>
date Sun, 11 Oct 2009 22:39:23 +0200
parents 171ae5a258fa
children 9ca672ee884f
files mcabber/mcabberrc.example mcabber/src/xmpp.c
diffstat 2 files changed, 21 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabberrc.example	Sun Oct 11 22:02:06 2009 +0200
+++ b/mcabber/mcabberrc.example	Sun Oct 11 22:39:23 2009 +0200
@@ -245,9 +245,11 @@
 
 # Traces logging
 # If you want advanced traces, please specify a file and a level here.
-# There are currently 2 traceloglog levels:
+# There are currently 4 traceloglog levels:
 #  lvl 1: most events of the log window are written to the file
-#  lvl 2: debug logging (XML, etc.)
+#  lvl 2: Loudmouth verbose logging
+#  lvl 3: debug logging (XML, etc.)
+#  lvl 4: noisy debug logging (Loudmouth parser...)
 # Default is level 0, no trace logging
 #set tracelog_level = 1
 #set tracelog_file = ~/.mcabber/mcabber.log
--- a/mcabber/src/xmpp.c	Sun Oct 11 22:02:06 2009 +0200
+++ b/mcabber/src/xmpp.c	Sun Oct 11 22:39:23 2009 +0200
@@ -1532,29 +1532,33 @@
                               const gchar    *message,
                               gpointer        user_data)
 {
-  if (settings_opt_get_int("tracelog_level") != 2)
-    return;
-  if (message) {
+  if (message && *message) {
     char *msg;
+    int mcabber_loglevel = settings_opt_get_int("tracelog_level");
+
+    if (mcabber_loglevel < 2)
+      return;
+
     if (message[0] == '\n')
       msg = g_strdup(&message[1]);
     else
       msg = g_strdup(message);
-    if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = '\0';
+
+    if (msg[strlen(msg)-1] == '\n')
+      msg[strlen(msg)-1] = '\0';
 
     if (log_level & LM_LOG_LEVEL_VERBOSE) {
       scr_LogPrint(LPRINT_DEBUG, "LM-VERBOSE: %s", msg);
     }
-    if ((LmLogLevelFlags)log_level & LM_LOG_LEVEL_NET) {
-      scr_LogPrint(LPRINT_DEBUG, "LM-NET: %s", msg);
-    }
-    else if (log_level & LM_LOG_LEVEL_PARSER) {
-      scr_LogPrint(LPRINT_DEBUG, "LM-PARSER: %s", msg);
-    }
-    else if (log_level & LM_LOG_LEVEL_SASL) {
+    if (log_level & LM_LOG_LEVEL_NET) {
+      if (mcabber_loglevel > 2)
+        scr_LogPrint(LPRINT_DEBUG, "LM-NET: %s", msg);
+    } else if (log_level & LM_LOG_LEVEL_PARSER) {
+      if (mcabber_loglevel > 3)
+        scr_LogPrint(LPRINT_DEBUG, "LM-PARSER: %s", msg);
+    } else if (log_level & LM_LOG_LEVEL_SASL) {
       scr_LogPrint(LPRINT_DEBUG, "LM-SASL: %s", msg);
-    }
-    else if (log_level & LM_LOG_LEVEL_SSL) {
+    } else if (log_level & LM_LOG_LEVEL_SSL) {
       scr_LogPrint(LPRINT_DEBUG, "LM-SSL: %s", msg);
     }
     g_free(msg);