[GNC-dev] gnc:debug changes

Mike Alexander mta at umich.edu
Sat Mar 7 01:18:01 EST 2020

On 7 Mar 2020, at 0:39, Christopher Lam wrote:

> I'd thought that the log level would be an invariant per session. If 
> log levels could be amended mid-session I'd like to see how.

Call qof-log-set-level.  It works fine without the most recent change to 
gnc:debug.  I put a few calls to it into 
gnc:price-quotes-install-sources to test this.  I made sure to compile 
the Scheme code in case compilation changed things.

> The gnc:debug was optimized because there was (gnc:debug pricelist) 
> whereby a long pricelist (which is realistic) would obligatorily lead 
> to string-join and map in strify, and was definitely a  _major_ 
>  slowdown. Conclusion: we don't want to call strify with a long list 
> unnecessarily.

I understand.  Avoiding the call to strify is a good idea and I don't 
intend to change that.  I was simply pointing out that evaluating the 
args to gnc:debug may also take some time.  In the case you mention 
presumably pricelist already exists, but sometimes the debug output has 
to be created by calling other functions which can take time.  I don't 
think it's possible to avoid that by changing gnc:debug, at least not 

> If log level is not an invariant, assuming qof_log_check is fast, 
> would be:
> (define (gnc:debug items)
>   (when (qof-log-check "gnc" QOF-LOG-DEBUG)
>     (gnc-scm-log-debug (strify items))))

Yes, that's what I have in mind except change the first arg to 
qof-log-check to "gnc.scm" which is the original bug that I was looking 


More information about the gnucash-devel mailing list