mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
(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.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15637 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
449c4242e2
commit
49501c2dbb
@ -14,6 +14,11 @@ gchar * g_find_program_in_path(const gchar *);
|
||||
|
||||
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 * ""
|
||||
|
@ -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)
|
||||
|
@ -250,3 +250,27 @@ gnc_g_list_cut(GList **list, GList *cut_point)
|
||||
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);
|
||||
}
|
||||
|
@ -95,6 +95,11 @@ GList* gnc_g_list_map(GList* list, GncGMapFunc fn, gpointer user_data);
|
||||
**/
|
||||
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 */
|
||||
|
@ -163,28 +163,20 @@
|
||||
|
||||
;;;; 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
|
||||
|
||||
|
@ -753,5 +753,7 @@ Run 'gnc-fq-update' as root to install them.") "\n")))
|
||||
(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))))))
|
||||
|
Loading…
Reference in New Issue
Block a user