[Gnucash-changes] r12999 - gnucash/trunk/lib/libqof/qof - Re-enable logging for GnuCash modules that haven't explicitly set their

Chris Shoemaker chris at cvs.gnucash.org
Sat Jan 28 12:17:50 EST 2006


Author: chris
Date: 2006-01-28 12:17:49 -0500 (Sat, 28 Jan 2006)
New Revision: 12999
Trac: http://svn.gnucash.org/trac/changeset/12999

Modified:
   gnucash/trunk/lib/libqof/qof/qoflog.c
Log:
   Re-enable logging for GnuCash modules that haven't explicitly set their
   own levels.


Modified: gnucash/trunk/lib/libqof/qof/qoflog.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qoflog.c	2006-01-28 12:30:43 UTC (rev 12998)
+++ gnucash/trunk/lib/libqof/qof/qoflog.c	2006-01-28 17:17:49 UTC (rev 12999)
@@ -48,6 +48,7 @@
 static const int MAX_TRACE_FILENAME = 100;
 static GHashTable *log_table = NULL;
 static gint qof_log_num_spaces = 0;
+static QofLogLevel global_default_loglevel = 0;
 
 /* uses the enum_as_string macro.
 Lookups are done on the string. */
@@ -135,6 +136,7 @@
 	gchar* level_string;
 
 	if(!log_table || level == 0) { return; }
+	global_default_loglevel = level;
 	level_string = g_strdup(QofLogLevelasString(level));
 	g_hash_table_foreach(log_table, log_module_foreach, level_string);
 }
@@ -310,9 +312,11 @@
 	log_string = NULL;
 	if(!log_table || log_module == NULL || log_level == 0) { return FALSE; }
 	log_string = (gchar*)g_hash_table_lookup(log_table, log_module);
-	/* if log_module not found, do not log. */
-	if(!log_string) { return FALSE; }
-	maximum = QofLogLevelfromString(log_string);
+	/* if log_module not found, use default. */
+	if (log_string) 
+	    maximum = QofLogLevelfromString(log_string);
+	else
+	    maximum = global_default_loglevel;
 	if(log_level <= maximum) { return TRUE; }
 	return FALSE;
 }



More information about the gnucash-changes mailing list