r15637 - gnucash/trunk/src - (Swig-)expose functions to g_log(...) at various levels; convert the gnc:{error,warn,msg,debug} functions to use those. Make sure the Finance::Quote version is sent to stdout no matter what.
Josh Sled
jsled at cvs.gnucash.org
Mon Feb 19 18:45:17 EST 2007
Author: jsled
Date: 2007-02-19 18:45:15 -0500 (Mon, 19 Feb 2007)
New Revision: 15637
Trac: http://svn.gnucash.org/trac/changeset/15637
Modified:
gnucash/trunk/src/core-utils/core-utils.i
gnucash/trunk/src/core-utils/core-utils.scm
gnucash/trunk/src/core-utils/gnc-glib-utils.c
gnucash/trunk/src/core-utils/gnc-glib-utils.h
gnucash/trunk/src/scm/main.scm
gnucash/trunk/src/scm/price-quotes.scm
Log:
(Swig-)expose functions to g_log(...) at various levels; convert the gnc:{error,warn,msg,debug} functions to use those. Make sure the Finance::Quote version is sent to stdout no matter what.
Modified: gnucash/trunk/src/core-utils/core-utils.i
===================================================================
--- gnucash/trunk/src/core-utils/core-utils.i 2007-02-19 23:06:41 UTC (rev 15636)
+++ gnucash/trunk/src/core-utils/core-utils.i 2007-02-19 23:45:15 UTC (rev 15637)
@@ -14,6 +14,11 @@
gboolean gnc_is_debugging(void);
+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 *);
+
/* Special treatment because the string changes in place. */
%typemap(in) gchar * " $1 = SCM_STRING_CHARS($input); "
%typemap(freearg) gchar * ""
Modified: gnucash/trunk/src/core-utils/core-utils.scm
===================================================================
--- gnucash/trunk/src/core-utils/core-utils.scm 2007-02-19 23:06:41 UTC (rev 15636)
+++ gnucash/trunk/src/core-utils/core-utils.scm 2007-02-19 23:45:15 UTC (rev 15637)
@@ -12,3 +12,7 @@
(re-export gnc-is-debugging)
(re-export g-find-program-in-path)
(re-export gnc-utf8-strip-invalid)
+(re-export gnc-scm-log-warn)
+(re-export gnc-scm-log-error)
+(re-export gnc-scm-log-msg)
+(re-export gnc-scm-log-debug)
Modified: gnucash/trunk/src/core-utils/gnc-glib-utils.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-glib-utils.c 2007-02-19 23:06:41 UTC (rev 15636)
+++ gnucash/trunk/src/core-utils/gnc-glib-utils.c 2007-02-19 23:45:15 UTC (rev 15637)
@@ -250,3 +250,27 @@
cut_point->prev->next = NULL;
cut_point->prev = NULL;
}
+
+void
+gnc_scm_log_warn(const gchar *msg)
+{
+ g_log("gnc.scm", G_LOG_LEVEL_WARNING, msg);
+}
+
+void
+gnc_scm_log_error(const gchar *msg)
+{
+ g_log("gnc.scm", G_LOG_LEVEL_CRITICAL, msg);
+}
+
+void
+gnc_scm_log_msg(const gchar *msg)
+{
+ g_log("gnc.scm", G_LOG_LEVEL_MESSAGE, msg);
+}
+
+void
+gnc_scm_log_debug(const gchar *msg)
+{
+ g_log("gnc.scm", G_LOG_LEVEL_DEBUG, msg);
+}
Modified: gnucash/trunk/src/core-utils/gnc-glib-utils.h
===================================================================
--- gnucash/trunk/src/core-utils/gnc-glib-utils.h 2007-02-19 23:06:41 UTC (rev 15636)
+++ gnucash/trunk/src/core-utils/gnc-glib-utils.h 2007-02-19 23:45:15 UTC (rev 15637)
@@ -95,6 +95,11 @@
**/
void gnc_g_list_cut(GList **list, GList *cut_point);
+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);
+
/** @} */
#endif /* GNC_GLIB_UTILS_H */
Modified: gnucash/trunk/src/scm/main.scm
===================================================================
--- gnucash/trunk/src/scm/main.scm 2007-02-19 23:06:41 UTC (rev 15636)
+++ gnucash/trunk/src/scm/main.scm 2007-02-19 23:45:15 UTC (rev 15637)
@@ -163,29 +163,21 @@
;;;; Status output functions.
+(define (strify items)
+ (string-join (map (lambda (x) (simple-format #f "~A" x)) items) ""))
+
(define (gnc:warn . items)
- (display "gnucash: [W] ")
- (for-each (lambda (i) (write i)) items)
- (newline))
+ (gnc-scm-log-warn (strify items)))
(define (gnc:error . items)
- (display "gnucash: [E] ")
- (for-each (lambda (i) (write i)) items)
- (newline))
+ (gnc-scm-log-error (strify items )))
(define (gnc:msg . items)
- (display "gnucash: [M] ")
- (for-each (lambda (i) (write i)) items)
- (newline))
+ (gnc-scm-log-msg (strify items)))
(define (gnc:debug . items)
- (if (gnc-is-debugging)
- (begin
- (display "gnucash: [D] ")
- (for-each (lambda (i) (write i)) items)
- (newline))))
+ (gnc-scm-log-debug (strify items)))
-
;; Set up timing functions
(define gnc:*last-time* (gettimeofday))
Modified: gnucash/trunk/src/scm/price-quotes.scm
===================================================================
--- gnucash/trunk/src/scm/price-quotes.scm 2007-02-19 23:06:41 UTC (rev 15636)
+++ gnucash/trunk/src/scm/price-quotes.scm 2007-02-19 23:45:15 UTC (rev 15637)
@@ -753,5 +753,7 @@
(let ((sources (gnc:fq-check-sources)))
(if (list? sources)
(begin
+ (simple-format #t "Found Finance::Quote version ~A" (car sources))
+ (newline)
(gnc:msg "Found Finance::Quote version " (car sources))
(gnc-quote-source-set-fq-installed (cdr sources))))))
More information about the gnucash-changes
mailing list