Hi Mike. 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.
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. 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)))) On Sat, 7 Mar 2020 at 05:25, Mike Alexander <m...@umich.edu> wrote: > I spent some time yesterday figuring out why gnc:debug never produced > any output regardless of the gnc.scm log level. I tracked it down to > commits 42b6fb9 and b3a4cd6 from last July. The actual bug is trivial > (they test for the log level for "gnc" instead of "gnc.scm") but I > wonder if b3a4cd6 is a good idea. It has the effect of binding the > gnc.scm log level on the first call to gnc:debug and ignoring subsequent > changes to it. This means that later calls to (qof-log-set-level > "gnc.scm" ...) will have no effect. It is sometimes useful to turn on > and off Scheme debugging around sections of code you care about. > > The optimization from b3a4cd6 seems to be relatively minor. The > arguments to gnc:debug are evaluated when debugging is off even with > this change (something I verified) and the call to strify is avoided > even without it. All you're really avoiding is the actual call to > gnc:debug and the call to qof-log-check. I propose reverting back to > 42b6fb9 with the bugs in it fixed. Is this ok? If so I'll push a > change. > > Mike > _______________________________________________ > gnucash-devel mailing list > gnucash-devel@gnucash.org > https://lists.gnucash.org/mailman/listinfo/gnucash-devel > _______________________________________________ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel