gnc-trace module numbers

Neil Williams linux at codehelp.co.uk
Thu Sep 29 07:32:29 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

The default is now no logging at all. The default target is stderr.

There is a recommended call - qof_log_set_default() - which sets the core QOF 
log_modules to DETAIL. Other log_modules are set by the application at 
startup - QOF doesn't know what those are in advance.

> >                 gnc_log_init();
>
> This is in gnc-engine.c and self-tested in gnc-trace.c

OK, that's where I've added new versions of these calls (using strings):

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

The enum no longer exists (because the QofLogModule is a gchar*).

> and by the 
> command-line through scheme.

That's what I can't find - how to tell the scheme to accept a gchar instead of 
an int for gnc_set_log_level.

> > 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/ You just need to change the
> definitions in gw-engine-spec.scm

Can't find anything relevant in there, just a single global call.

On the subject of PACKAGE etc., QOF doesn't know the PACKAGE when running as 
an external library, PACKAGE would be qof. So the application has to pass 
this to QOF and it's up to the application developer whether to use PACKAGE 
or simply set the name in the string.

There's a new routine that is to be used in GnuCash to replace gnc_log_init() 
- qof_log_init_filename(const gchar* filename) - which sets the application's 
preferred filename *and* initialises the logging subsystem in one call. That 
way, if the file cannot be opened QOF will try a temporary file based on that 
filename or if that fails, revert to stderr. If filename == NULL, QOF uses 
stderr.

-- 

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/20050929/5594ee24/attachment.bin


More information about the gnucash-devel mailing list