From b3a4cd62775705b2543438f912ca71dad591bf0e Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Sun, 7 Jul 2019 08:30:54 +0800 Subject: [PATCH] completion redefine gnc:debug --- libgnucash/scm/utilities.scm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libgnucash/scm/utilities.scm b/libgnucash/scm/utilities.scm index d359dd4db0..4e3af3fdc6 100644 --- a/libgnucash/scm/utilities.scm +++ b/libgnucash/scm/utilities.scm @@ -66,9 +66,18 @@ (define (gnc:msg . items) (gnc-scm-log-msg (strify items))) -(define (gnc:debug . items) - (when (qof-log-check "gnc" G-LOG-LEVEL-DEBUG) - (gnc-scm-log-debug (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)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; the following functions are initialized to log message to tracefile