QofLogModule definitions

Neil Williams linux at codehelp.co.uk
Sat Oct 1 16:54:22 EDT 2005


On Saturday 01 October 2005 9:09 pm, David Hampton wrote:

As a follow-on to this:

> P.S. What was your reasoning for moving the trace definitions from gnc-
> trace.h to gnc-engine.h?

Don't forget that gnc-trace.h|c will not be in the GnuCash tree for long, it 
is going into QOF as qoflog.c|h and will not be able to contain any 
definitions for GnuCash, cashutil or any other application using QOF. That's 
the entire premise behind this large change - to remove gnucash-specific code 
from QOF as I prepare for 0.6.0 final release.

QofLogModule has de-centralised the entire log_module setup - no single 
location is necessary, desirable or even possible anymore. You cannot 
centralise what belongs in two different source trees. This isn't just about 
cashutil (which does use it's own log_modules), it's about all other QOF 
applications too.

> I'm having to add the latter header to source 
> files that never needed it before, and in fact have nothing to do with
> the code in src/engine.

Only include gnc-engine.h if you want to use the engine log_modules. If the 
code has nothing to do with the engine, use your own log_modules and define 
them locally. There is now no limit to the number and specificity of 
log_modules - you can even define more than one WITHIN a file if you are 
careful.

You can make the log output as specific as you like, enabling you to uniquely 
follow specific program flow paths with no extraneous messages, simply by 
tweaking the log_module and creating local ones.

Personally, I think GNC_MOD_GUI is too wide and although it may be useful as a 
catch-all (which is why I put it in gnc-engine.h), there's no reason not to 
have GNC_MOD_TREE GNC_MOD_VIEW GNC_MOD_ whatever. There is also absolutely no 
reason to have those in any one file - put them wherever you like, according 
to the files that will be using them.

Give them a gnucash- prefix in the actual text:

#define GNC_MOD_TREE "gnucash-gui-tree"

and all will be well. It is important that each log_module is a unique string 
and the simplest way to ensure that is to prefix it with the application 
name.

-- 

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/20051001/ca63c595/attachment.bin


More information about the gnucash-devel mailing list