gnc-trace module numbers

Neil Williams linux at
Sun Sep 25 13:51:26 EDT 2005

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

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_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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :

More information about the gnucash-devel mailing list