gnc-trace module numbers
Neil Williams
linux at codehelp.co.uk
Tue Sep 27 09:41:33 EDT 2005
On Tuesday 27 September 2005 2:08 pm, Derek Atkins wrote:
> Neil Williams <linux at codehelp.co.uk> writes:
> > gnc_set_logfile(f);
>
> Not done. It uses the default
It'll need to be done with this change - the default was gnucash.trace and
this change is to make the trace less gnucash-specific. The default filename
is now qof.trace and each application should set their own filename.
> > 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);
>
> These are done in the enum-structure in gnc-trace.c and by the
> command-line through scheme.
>
> > I know it's not defined static like that and that gnucash can use command
> > line options to specify the modules and log detail, I'm hoping it's not
> > in the Scheme!
>
> Why? Changing the scheme is /EASY/
I never like editing files I don't understand.
:-)
How would I implement the filename change?
FILE f*;
f = fopen("/tmp/gnucash.trace", "w");
gnc_set_logfile(f);
gnc_log_init();
...
if(f) { fclose(f); }
Also, I've created a qof_log_set_default() call that sets the extra
log_modules that QOF now uses (it's not all engine).
The standard QOF log_modules are now:
QOF_MOD_BACKEND
QOF_MOD_CLASS
QOF_MOD_ENGINE
QOF_MOD_OBJECT
QOF_MOD_KVP
QOF_MOD_MERGE
QOF_MOD_QUERY
QOF_MOD_SESSION
or it's just as easy to call qof_log_set_default(gncLogLevel log_level);
There's also a foreach in case anyone needs it, and a count of the number of
log_modules that have a non-zero log_level.
All are defined in <qof.h> (which is now fixed).
There is no limit to the number of log_modules - it should be possible to
define log_module within a function and use a specific log_module for a set
of functions and a different one in other functions. This is in case one
source file contains code you want to log separately.
GNC_MOD_ENGINE could refer to the gnucash-specific engine code. We could also
use GNC_MOD_OBJECT for the objects.
Note also that I've changed from
static short module
to
static gchar* log_module.
The use of a hashtable also means gnc_should_log can no longer be inlined as
was the original plan in gnc-trace.c.
--
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/20050927/f0fbe06f/attachment.bin
More information about the gnucash-devel
mailing list