From 7765e1370489c6b4d31a36956082a19ae740d736 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Wed, 17 Mar 2021 15:04:02 +0100 Subject: [PATCH] Bindings - move log wrappers into the swig interface files They are only used for guile (and possibly python, so there's no need to carry them around in core-utils. --- bindings/core-utils.i | 5 ----- bindings/engine.i | 9 +++++++++ bindings/guile/utilities.scm | 8 ++++---- libgnucash/core-utils/gnc-glib-utils.c | 24 ------------------------ libgnucash/core-utils/gnc-glib-utils.h | 10 ---------- 5 files changed, 13 insertions(+), 43 deletions(-) diff --git a/bindings/core-utils.i b/bindings/core-utils.i index 6cef88a988..e950532abc 100644 --- a/bindings/core-utils.i +++ b/bindings/core-utils.i @@ -90,11 +90,6 @@ gchar * gnc_build_stdreports_path(const gchar *); %newobject gnc_build_reports_path; gchar * gnc_build_reports_path(const gchar *); -void gnc_scm_log_warn(const gchar *); -void gnc_scm_log_error(const gchar *); -void gnc_scm_log_msg(const gchar *); -void gnc_scm_log_debug(const gchar *); - %newobject gnc_utf8_strip_invalid_strdup; gchar * gnc_utf8_strip_invalid_strdup(const gchar *); diff --git a/bindings/engine.i b/bindings/engine.i index a93e573a96..7bd3f274e1 100644 --- a/bindings/engine.i +++ b/bindings/engine.i @@ -111,6 +111,15 @@ engine-common.i */ %include "qoflog.h" %inline %{ +static void gnc_log_warn(const char *msg) +{ g_log("gnc.scm", G_LOG_LEVEL_WARNING, "%s", msg); } +static void gnc_log_error(const char *msg) +{ g_log("gnc.scm", G_LOG_LEVEL_CRITICAL, "%s", msg); } +static void gnc_log_msg(const char *msg) +{ g_log("gnc.scm", G_LOG_LEVEL_MESSAGE, "%s", msg); } +static void gnc_log_debug(const char *msg) +{ g_log("gnc.scm", G_LOG_LEVEL_DEBUG, "%s", msg); } + static const GncGUID * gncPriceGetGUID(GNCPrice *x) { return qof_instance_get_guid(QOF_INSTANCE(x)); } static const GncGUID * gncBudgetGetGUID(GncBudget *x) diff --git a/bindings/guile/utilities.scm b/bindings/guile/utilities.scm index 0ac565dac0..e83b917ba2 100644 --- a/bindings/guile/utilities.scm +++ b/bindings/guile/utilities.scm @@ -40,17 +40,17 @@ (string-join (map (lambda (x) (format #f "~A" x)) items) "")) (define (gnc:warn . items) - (gnc-scm-log-warn (strify items))) + (gnc-log-warn (strify items))) (define (gnc:error . items) - (gnc-scm-log-error (strify items ))) + (gnc-log-error (strify items ))) (define (gnc:msg . items) - (gnc-scm-log-msg (strify items))) + (gnc-log-msg (strify items))) (define (gnc:debug . items) (when (qof-log-check "gnc.scm" QOF-LOG-DEBUG) - (gnc-scm-log-debug (strify items)))) + (gnc-log-debug (strify items)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; the following functions are initialized to log message to tracefile diff --git a/libgnucash/core-utils/gnc-glib-utils.c b/libgnucash/core-utils/gnc-glib-utils.c index 0dd36b9bc3..b2e55af29b 100644 --- a/libgnucash/core-utils/gnc-glib-utils.c +++ b/libgnucash/core-utils/gnc-glib-utils.c @@ -287,30 +287,6 @@ gnc_g_list_cut(GList **list, GList *cut_point) cut_point->prev = NULL; } -void -gnc_scm_log_warn(const gchar *msg) -{ - g_log("gnc.scm", G_LOG_LEVEL_WARNING, "%s", msg); -} - -void -gnc_scm_log_error(const gchar *msg) -{ - g_log("gnc.scm", G_LOG_LEVEL_CRITICAL, "%s", msg); -} - -void -gnc_scm_log_msg(const gchar *msg) -{ - g_log("gnc.scm", G_LOG_LEVEL_MESSAGE, "%s", msg); -} - -void -gnc_scm_log_debug(const gchar *msg) -{ - g_log("gnc.scm", G_LOG_LEVEL_DEBUG, "%s", msg); -} - gchar * gnc_g_list_stringjoin (GList *list_of_strings, const gchar *sep) diff --git a/libgnucash/core-utils/gnc-glib-utils.h b/libgnucash/core-utils/gnc-glib-utils.h index dc3046f4c6..eb291336bb 100644 --- a/libgnucash/core-utils/gnc-glib-utils.h +++ b/libgnucash/core-utils/gnc-glib-utils.h @@ -169,16 +169,6 @@ void gnc_g_list_cut(GList **list, GList *cut_point); /** @} */ -/** @name Message Logging - @{ -*/ -void gnc_scm_log_warn(const gchar *msg); -void gnc_scm_log_error(const gchar *msg); -void gnc_scm_log_msg(const gchar *msg); -void gnc_scm_log_debug(const gchar *msg); - -/** @} */ - /** * @brief Return a string joining a GList whose elements are gchar*