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

Chris Shoemaker c.shoemaker at cox.net
Sun Jan 29 16:23:39 EST 2006


First, reread what you wrote:

On Sun, Jan 29, 2006 at 03:58:28PM +0000, Neil Williams wrote:
> 
> > A) you don't realize that because the variable is initialized to zero,
> > NOT A SINGLE message will get logged that wasn't logged before in ANY
> > program ANYWHERE, _or_
> 
> Wrong. Your modification to qof_log_check means that even if a module is NOT 
> listed in the hashtable, the check returns TRUE even if loglevel is zero. 
> That's plain wrong. Only modules in the hashtable should be logged. There can 
> be no else{} statement. Zero is not "do not log", zero is GNC_LOG_FATAL which 
> still results in some logging.
> 
> Your modification means that qof_log_check returns true every time for 
> GNC_LOG_FATAL and that simply isn't acceptable.
> 
> If         log_string = (gchar*)g_hash_table_lookup(log_table, log_module);
> returns non-NULL, then we can test if the loglevel is sufficient. When it 
> returns NULL, log_check MUST return FALSE.

Now read the code:

gboolean
qof_log_check(QofLogModule log_module, QofLogLevel log_level)
{
        gchar* log_string;
        QofLogLevel maximum; /* Any log_level less than this will be logged. */

        log_string = NULL;                     /* vvvvvvvv  LOOK HERE, NEIL! */
        if(!log_table || log_module == NULL || log_level == 0) 
              { return FALSE; }
        log_string = (gchar*)g_hash_table_lookup(log_table, log_module);
...


Is it really possible you didn't read this before starting this tirade?

This is just astounding.  If you really didn't get this then I
apologize for my harsh tone.  This is why there's just no substitute
for really looking at the code and making it work.  You _incorrect_
assumptions are exposed, which is a good thing.

-chris


More information about the gnucash-devel mailing list