gnucash maint: Revert "completion redefine gnc:debug" and fix some bugs in it

Mike Alexander mta at
Sat Mar 7 23:53:18 EST 2020

Updated	 via (commit)
	from (commit)

commit 4318f7a3c7825aedab87b32b27601f67983343e0
Author: Mike Alexander <mta at>
Date:   Fri Mar 6 03:31:59 2020 -0500

    Revert "completion redefine gnc:debug" and fix some bugs in it
    This change made it impossible to turn debug output on or off on the
    fly by calling qof-log-set-level from Scheme code.  The optimization
    achieved isn't all that great either since the arguements to
    gnc:debug are still evaluated when debugging is off and this is
    where a lot of the overhead is. Even without this change the call to
    strify is avoided.
    Also fixed the parameters of qof-log-check:
        "gmc" => "gnc.scm"
    This reverts commit b3a4cd62775705b2543438f912ca71dad591bf0e.

diff --git a/libgnucash/scm/utilities.scm b/libgnucash/scm/utilities.scm
index 4fcf60b82..c70f4544a 100644
--- a/libgnucash/scm/utilities.scm
+++ b/libgnucash/scm/utilities.scm
@@ -68,18 +68,9 @@
 (define (gnc:msg . items)
   (gnc-scm-log-msg (strify items)))
-;; this definition of gnc:debug is different from others because we
-;; want to check loglevel is debug *once* at gnc:debug definition
-;; instead of every call to gnc:debug. if loglevel isn't debug then
-;; gnc:debug becomes a NOOP.
-(define gnc:debug
-  (cond
-   ((qof-log-check "gnc" QOF-LOG-DEBUG)
-    (display "debugging enabled\n")
-    (lambda items (gnc-scm-log-debug (strify items))))
-   (else
-    (lambda items #f))))
+(define (gnc:debug . items)
+  (when (qof-log-check "gnc:scm" QOF-LOG-DEBUG)
+    (gnc-scm-log-debug (strify items))))
 ;; the following functions are initialized to log message to tracefile

Summary of changes:
 libgnucash/scm/utilities.scm | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

More information about the gnucash-changes mailing list