gnc-trace module numbers

Neil Williams linux at codehelp.co.uk
Sun Sep 25 13:51:26 EDT 2005


I'm looking again at gnc-trace because I want to make it less GnuCash 
specific.

I feel we need to let any QOF application create their own traces with their 
own list of modules and not force MOD_GUI, MOD_LOT, MOD_ACCOUNT, 
MOD_SX and others onto other applications. 

In cashutil, I've been using:
	if(debug_on) {
		f = fopen("/tmp/cashutil.trace", "w");
		gnc_set_logfile(f);
		gnc_log_init();
		gnc_set_log_level(MOD_BACKEND, GNC_LOG_DETAIL);
		gnc_set_log_level(MOD_ENGINE, GNC_LOG_DETAIL);
		gnc_set_log_level(MOD_IO, GNC_LOG_DETAIL);
	}

I also want a MOD_CLI, MOD_SHELL, MOD_PILOT and a few others, without 
having these hard-coded into QOF or lumped into G2.

So how to extend gncModuleType?

Make gnc_log_modules (which is probably best as just a default) into a setup 
call for a GHashTable and dump gncModuleType altogether?

gnc_set_log_level would be a g_hash_table_insert internally,

gnc_set_log_level_global would use a g_hash_table_foreach internally,

gnc_should_log would be a g_hash_table_lookup.

Then each application could call gnc_set_log_level to set up it's defaults.

In effect, the above snippet from CashUtil would be all that is needed to 
handle the debug output. (I'll extend CashUtil later to accept different 
gncLogLevel values.)

Just an idea so far.

If gnc_log_modules is also dumped, gnc_set_log_level would simply check for 
the hash table and create it if it wasn't found before the first insert. 
That's my preference at the moment.

-- 

Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20050925/a7f36c06/attachment.bin


More information about the gnucash-devel mailing list