# HG changeset patch # User Mikael Berthe # Date 1255293563 -7200 # Node ID 4c7104ec5f3bc8bc2068b314d795602096ae7256 # Parent 171ae5a258fad5c1d1c48731df32a2d056a44b55 Add 2 debugging levels (for 'tracelog_level') diff -r 171ae5a258fa -r 4c7104ec5f3b mcabber/mcabberrc.example --- 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 diff -r 171ae5a258fa -r 4c7104ec5f3b mcabber/src/xmpp.c --- 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);