gnucash maint: Bug 798237 - Logging during XML file loading degrades performance...
John Ralls
jralls at code.gnucash.org
Tue Sep 14 18:22:10 EDT 2021
Updated via https://github.com/Gnucash/gnucash/commit/74d06308 (commit)
from https://github.com/Gnucash/gnucash/commit/574f567b (commit)
commit 74d0630867c6cfbb509db2f4ca7edb722db82956
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Sep 14 15:15:11 2021 -0700
Bug 798237 - Logging during XML file loading degrades performance...
significantly
Modify the DEBUG and PINFO macros to return unless qof_log_check is
true. Replace almost all direct calls to g_debug and g_message with
DEBUG and PINFO respectively.
Track the highest logging level sent to qof_log_set_level to provide a
short-circuit return in qof_log_check. Remove setting GNC_MOD_TESTS to
QOF_LOG_DEBUG so that the short-circuit threshold isn't defeated by
always being DEBUG.
Net result: 33% improvement in xml load times.
diff --git a/bindings/core-utils.i b/bindings/core-utils.i
index e5cd3cf54..bd066cecb 100644
--- a/bindings/core-utils.i
+++ b/bindings/core-utils.i
@@ -93,7 +93,7 @@ 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 *);
+void gnc_scm_loDEBUG(const gchar *);
%newobject gnc_utf8_strip_invalid_strdup;
gchar * gnc_utf8_strip_invalid_strdup(const gchar *);
diff --git a/gnucash/gnome-utils/gnc-autosave.c b/gnucash/gnome-utils/gnc-autosave.c
index cd7083140..a62ec82a9 100644
--- a/gnucash/gnome-utils/gnc-autosave.c
+++ b/gnucash/gnome-utils/gnc-autosave.c
@@ -35,6 +35,7 @@
#include "gnc-main-window.h"
#include "gnc-gui-query.h"
#include "dialog-utils.h"
+#include <qoflog.h>
#define GNC_PREF_AUTOSAVE_SHOW_EXPLANATION "autosave-show-explanation"
#define GNC_PREF_AUTOSAVE_INTERVAL "autosave-interval-minutes"
@@ -44,6 +45,7 @@
# undef G_LOG_DOMAIN
#endif
#define G_LOG_DOMAIN "gnc.gui.autosave"
+static const QofLogModule log_module = G_LOG_DOMAIN;
static void
autosave_remove_timer_cb(QofBook *book, gpointer key, gpointer user_data);
@@ -156,14 +158,14 @@ static gboolean autosave_confirm(GtkWidget *toplevel)
/* Should we show this explanation again? */
gnc_prefs_set_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTOSAVE_SHOW_EXPLANATION, show_expl_again);
- g_debug("autosave_timeout_cb: Show explanation again=%s\n",
+ DEBUG("autosave_timeout_cb: Show explanation again=%s\n",
(show_expl_again ? "TRUE" : "FALSE"));
/* Should we switch off autosave? */
if (switch_off_autosave)
{
gnc_prefs_set_float(GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTOSAVE_INTERVAL, 0);
- g_debug("autosave_timeout_cb: User chose to disable auto-save.\n");
+ DEBUG("autosave_timeout_cb: User chose to disable auto-save.\n");
}
return save_now;
@@ -177,7 +179,7 @@ static gboolean autosave_timeout_cb(gpointer user_data)
gboolean save_now = TRUE;
GtkWidget *toplevel;
- g_debug("autosave_timeout_cb called\n");
+ DEBUG("autosave_timeout_cb called\n");
/* Is there already a save in progress? If yes, return FALSE so that
the timeout is automatically destroyed and the function will not
@@ -199,17 +201,17 @@ static gboolean autosave_timeout_cb(gpointer user_data)
if (save_now)
{
- g_debug("autosave_timeout_cb: Really trigger auto-save now.\n");
+ DEBUG("autosave_timeout_cb: Really trigger auto-save now.\n");
/* Timeout has passed - save the file. */
if (GNC_IS_MAIN_WINDOW(toplevel))
gnc_main_window_set_progressbar_window( GNC_MAIN_WINDOW( toplevel ) );
else
- g_debug("autosave_timeout_cb: toplevel is not a GNC_MAIN_WINDOW\n");
+ DEBUG("autosave_timeout_cb: toplevel is not a GNC_MAIN_WINDOW\n");
if (GNC_IS_WINDOW(toplevel))
gnc_window_set_progressbar_window( GNC_WINDOW( toplevel ) );
else
- g_debug("autosave_timeout_cb: toplevel is not a GNC_WINDOW\n");
+ DEBUG("autosave_timeout_cb: toplevel is not a GNC_WINDOW\n");
gnc_file_save (GTK_WINDOW (toplevel));
@@ -223,7 +225,7 @@ static gboolean autosave_timeout_cb(gpointer user_data)
}
else
{
- g_debug("autosave_timeout_cb: No auto-save this time, let the timeout run again.\n");
+ DEBUG("autosave_timeout_cb: No auto-save this time, let the timeout run again.\n");
/* Return TRUE so that the timeout is not removed but will be
triggered again after the next time interval. */
return TRUE;
@@ -239,7 +241,7 @@ autosave_remove_timer_cb(QofBook *book, gpointer key, gpointer user_data)
if (autosave_source_id > 0)
{
res = g_source_remove (autosave_source_id);
- g_debug("Removing auto save timer with id %d, result=%s\n",
+ DEBUG("Removing auto save timer with id %d, result=%s\n",
autosave_source_id, (res ? "TRUE" : "FALSE"));
/* Set the event source id to zero. */
@@ -269,7 +271,7 @@ static void gnc_autosave_add_timer(QofBook *book)
guint autosave_source_id =
g_timeout_add_seconds(interval_mins * 60,
autosave_timeout_cb, book);
- g_debug("Adding new auto-save timer with id %d\n", autosave_source_id);
+ DEBUG("Adding new auto-save timer with id %d\n", autosave_source_id);
/* Save the event source id for a potential removal, and also
set the callback upon book closing */
@@ -281,13 +283,13 @@ static void gnc_autosave_add_timer(QofBook *book)
void gnc_autosave_dirty_handler (QofBook *book, gboolean dirty)
{
- g_debug("gnc_main_window_autosave_dirty(dirty = %s)\n",
+ DEBUG("gnc_main_window_autosave_dirty(dirty = %s)\n",
(dirty ? "TRUE" : "FALSE"));
if (dirty)
{
if (qof_book_is_readonly(book))
{
- //g_debug("Book is read-only, ignoring dirty flag");
+ //DEBUG("Book is read-only, ignoring dirty flag");
return;
}
@@ -303,7 +305,7 @@ void gnc_autosave_dirty_handler (QofBook *book, gboolean dirty)
}
else
{
- g_debug("Shutting down book, ignoring dirty book");
+ DEBUG("Shutting down book, ignoring dirty book");
}
}
else
diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index e2897889e..9fca03c76 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -33,6 +33,9 @@
#include <stdlib.h>
#include "gnc-date.h"
#include "dialog-utils.h"
+#include <qoflog.h>
+
+static const QofLogModule log_module = G_LOG_DOMAIN;
/**
* Marking ...
@@ -531,21 +534,21 @@ _gnc_dense_cal_set_month(GncDenseCal *dcal, GDateMonth mon, gboolean redraw)
dcal->month = mon;
g_timer_start(t);
recompute_first_of_month_offset(dcal);
- g_debug("recompute_first_of_month_offset: %f", g_timer_elapsed(t, NULL) * 1000.);
+ DEBUG("recompute_first_of_month_offset: %f", g_timer_elapsed(t, NULL) * 1000.);
g_timer_start(t);
recompute_extents(dcal);
- g_debug("recompute_extents: %f", g_timer_elapsed(t, NULL) * 1000.);
+ DEBUG("recompute_extents: %f", g_timer_elapsed(t, NULL) * 1000.);
if (redraw && gtk_widget_get_realized(GTK_WIDGET(dcal)))
{
g_timer_start(t);
recompute_x_y_scales(dcal);
- g_debug("recompute_x_y_scales: %f", g_timer_elapsed(t, NULL) * 1000.);
+ DEBUG("recompute_x_y_scales: %f", g_timer_elapsed(t, NULL) * 1000.);
g_timer_start(t);
gnc_dense_cal_draw_to_buffer(dcal);
- g_debug("draw_to_buffer: %f", g_timer_elapsed(t, NULL) * 1000.);
+ DEBUG("draw_to_buffer: %f", g_timer_elapsed(t, NULL) * 1000.);
g_timer_start(t);
gtk_widget_queue_draw(GTK_WIDGET(dcal->cal_drawing_area));
- g_debug("queue_draw: %f", g_timer_elapsed(t, NULL) * 1000.);
+ DEBUG("queue_draw: %f", g_timer_elapsed(t, NULL) * 1000.);
}
g_timer_stop(t);
g_timer_destroy(t);
@@ -883,7 +886,7 @@ gnc_dense_cal_draw(GtkWidget *widget, cairo_t *cr, gpointer user_data)
return TRUE;
}
-#define LOG_AND_RESET(timer, msg) do { g_debug("%s: %f", msg, g_timer_elapsed(timer, NULL) * 1000.); g_timer_reset(timer); } while (0);
+#define LOG_AND_RESET(timer, msg) do { DEBUG("%s: %f", msg, g_timer_elapsed(timer, NULL) * 1000.); g_timer_reset(timer); } while (0);
static void
gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
@@ -900,7 +903,7 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
gchar *primary_color_class, *secondary_color_class, *marker_color_class;
timer = g_timer_new();
- g_debug("drawing");
+ DEBUG("drawing");
widget = GTK_WIDGET(dcal);
if (!dcal->surface)
@@ -1361,7 +1364,7 @@ _gdc_view_option_changed(GtkComboBox *widget, gpointer user_data)
if (!gtk_combo_box_get_active_iter(widget, &iter))
return;
gtk_tree_model_get(model, &iter, VIEW_OPTS_COLUMN_NUM_MONTHS, &months_val, -1);
- g_debug("changing to %d months", months_val);
+ DEBUG("changing to %d months", months_val);
gnc_dense_cal_set_num_months(GNC_DENSE_CAL(user_data), months_val);
}
@@ -1791,7 +1794,7 @@ wheres_this(GncDenseCal *dcal, int x, int y)
if (g_date_get_julian(&d) >= g_date_get_julian(&startD))
{
/* we're past the end of the displayed calendar, thus -1 */
- g_debug("%d >= %d", g_date_get_julian(&d), g_date_get_julian(&startD));
+ DEBUG("%d >= %d", g_date_get_julian(&d), g_date_get_julian(&startD));
return -1;
}
@@ -1909,7 +1912,7 @@ static void
gdc_model_added_cb(GncDenseCalModel *model, guint added_tag, gpointer user_data)
{
GncDenseCal *cal = GNC_DENSE_CAL(user_data);
- g_debug("gdc_model_added_cb update\n");
+ DEBUG("gdc_model_added_cb update\n");
gdc_add_tag_markings(cal, added_tag);
}
@@ -1918,7 +1921,7 @@ gdc_model_update_cb(GncDenseCalModel *model, guint update_tag, gpointer user_dat
{
GncDenseCal *cal = GNC_DENSE_CAL (user_data);
gint num_marks = 0;
- g_debug ("gdc_model_update_cb update for tag [%d]\n", update_tag);
+ DEBUG ("gdc_model_update_cb update for tag [%d]\n", update_tag);
num_marks = gnc_dense_cal_model_get_instance_count (cal->model, update_tag);
// We need to redraw if there are no mark, to ensure they're all erased.
gdc_mark_remove (cal, update_tag, num_marks==0);
@@ -1930,7 +1933,7 @@ static void
gdc_model_removing_cb(GncDenseCalModel *model, guint remove_tag, gpointer user_data)
{
GncDenseCal *cal = GNC_DENSE_CAL(user_data);
- g_debug("gdc_model_removing_cb update [%d]\n", remove_tag);
+ DEBUG("gdc_model_removing_cb update [%d]\n", remove_tag);
gdc_mark_remove(cal, remove_tag, TRUE);
}
@@ -1983,7 +1986,7 @@ gdc_mark_add(GncDenseCal *dcal,
newMark->info = g_strdup(info);
newMark->tag = tag;
newMark->ourMarks = NULL;
- g_debug("saving mark with tag [%d]\n", newMark->tag);
+ DEBUG("saving mark with tag [%d]\n", newMark->tag);
for (i = 0; i < size; i++)
{
@@ -2016,7 +2019,7 @@ gdc_mark_remove(GncDenseCal *dcal, guint mark_to_remove, gboolean redraw)
/* Ignore non-realistic marks */
if ((gint)mark_to_remove == -1)
{
- g_debug("mark_to_remove = -1");
+ DEBUG("mark_to_remove = -1");
return;
}
@@ -2029,12 +2032,12 @@ gdc_mark_remove(GncDenseCal *dcal, guint mark_to_remove, gboolean redraw)
}
if (iter == NULL)
{
- g_message("couldn't find tag [%d]", mark_to_remove);
+ PINFO("couldn't find tag [%d]", mark_to_remove);
return;
}
if (mark_data == NULL)
{
- g_debug("mark_data == null");
+ DEBUG("mark_data == null");
return;
}
diff --git a/gnucash/gnome-utils/gnc-frequency.c b/gnucash/gnome-utils/gnc-frequency.c
index d07961b12..d6135e708 100644
--- a/gnucash/gnome-utils/gnc-frequency.c
+++ b/gnucash/gnome-utils/gnc-frequency.c
@@ -520,7 +520,7 @@ gnc_frequency_setup(GncFrequency *gf, GList *recurrences, const GDate *start_dat
else
{
Recurrence *r = (Recurrence*)recurrences->data;
- g_debug("recurrence period [%d]", recurrenceGetPeriodType(r));
+ DEBUG("recurrence period [%d]", recurrenceGetPeriodType(r));
switch (recurrenceGetPeriodType(r))
{
case PERIOD_ONCE:
diff --git a/gnucash/gnome-utils/gnc-gobject-utils.c b/gnucash/gnome-utils/gnc-gobject-utils.c
index ed0608ff9..8399e6297 100644
--- a/gnucash/gnome-utils/gnc-gobject-utils.c
+++ b/gnucash/gnome-utils/gnc-gobject-utils.c
@@ -25,10 +25,12 @@
#include <stdio.h>
#include "gnc-gobject-utils.h"
+#include <qoflog.h>
#include <gtk/gtk.h> // For gtk_main_quit(). Can't get this to work with
// a g_source attached to the main glib context.
+static const QofLogModule log_module = G_LOG_DOMAIN;
static void gnc_gobject_weak_cb (gpointer user_data, GObject *object);
@@ -70,7 +72,7 @@ static void
gnc_gobject_dump_gobject (GObject *object, const gchar *name)
{
//printf("Enter %s: object %p, name %s\n", G_STRFUNC, object, name);
- g_message(" object %p, ref count %d", object, object->ref_count);
+ PINFO(" object %p, ref count %d", object, object->ref_count);
//printf("Leave %s:\n", G_STRFUNC);
}
@@ -85,7 +87,7 @@ static gboolean
gnc_gobject_dump_list (const gchar *name, GList *list, gpointer user_data)
{
//printf("Enter %s: name %s, list %p\n", G_STRFUNC, name, list);
- g_message(" %d %s", g_list_length(list), name);
+ PINFO(" %d %s", g_list_length(list), name);
g_list_foreach(list, (GFunc)gnc_gobject_dump_gobject, (gpointer)name);
//printf("Leave %s:\n", G_STRFUNC);
return TRUE;
@@ -108,7 +110,7 @@ gnc_gobject_tracking_dump (void)
if (g_hash_table_size(table) > 0)
{
- g_message("The following objects remain alive:");
+ PINFO("The following objects remain alive:");
g_hash_table_foreach_remove(table, (GHRFunc)gnc_gobject_dump_list, NULL);
}
//printf("Leave %s:\n", G_STRFUNC);
diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index 45dd06253..1567e3a39 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -784,7 +784,7 @@ gnc_main_window_restore_window (GncMainWindow *window, GncMainWindowSaveData *da
(pos[1] + (geom ? geom[1] : 0) < 0) ||
(pos[1] > gdk_screen_height()))
{
- g_debug("position %dx%d, size%dx%d is offscreen; will not move",
+ DEBUG("position %dx%d, size%dx%d is offscreen; will not move",
pos[0], pos[1], geom ? geom[0] : 0, geom ? geom[1] : 0);
}
else
diff --git a/gnucash/gnome-utils/gnc-sx-instance-dense-cal-adapter.c b/gnucash/gnome-utils/gnc-sx-instance-dense-cal-adapter.c
index c71c2a0a2..3672f4fe8 100644
--- a/gnucash/gnome-utils/gnc-sx-instance-dense-cal-adapter.c
+++ b/gnucash/gnome-utils/gnc-sx-instance-dense-cal-adapter.c
@@ -34,9 +34,11 @@
#include <glib.h>
#include "gnc-sx-instance-dense-cal-adapter.h"
#include "gnc-dense-cal.h"
+#include <qoflog.h>
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "gnc.gui.sx.adapter.sx-dense-cal"
+static const QofLogModule log_module = G_LOG_DOMAIN;
static void gnc_sx_instance_dense_cal_adapter_dispose(GObject *obj);
static void gnc_sx_instance_dense_cal_adapter_finalize(GObject *obj);
@@ -94,7 +96,7 @@ static void
gsidca_instances_added_cb(GncSxInstanceModel *model, SchedXaction *sx_added, gpointer user_data)
{
GncSxInstanceDenseCalAdapter *adapter = GNC_SX_INSTANCE_DENSE_CAL_ADAPTER(user_data);
- g_debug("instance added\n");
+ DEBUG("instance added\n");
if (xaccSchedXactionGetEnabled(sx_added))
{
g_signal_emit_by_name(adapter, "added", GPOINTER_TO_UINT(sx_added));
@@ -106,7 +108,7 @@ gsidca_instances_updated_cb(GncSxInstanceModel *model, SchedXaction *sx_updated,
{
GncSxInstanceDenseCalAdapter *adapter = GNC_SX_INSTANCE_DENSE_CAL_ADAPTER(user_data);
gnc_sx_instance_model_update_sx_instances(model, sx_updated);
- g_debug("instances updated\n");
+ DEBUG("instances updated\n");
if (xaccSchedXactionGetEnabled(sx_updated))
{
g_signal_emit_by_name(adapter, "update", GPOINTER_TO_UINT((gpointer)sx_updated));
@@ -121,7 +123,7 @@ static void
gsidca_instances_removing_cb(GncSxInstanceModel *model, SchedXaction *sx_to_be_removed, gpointer user_data)
{
GncSxInstanceDenseCalAdapter *adapter = GNC_SX_INSTANCE_DENSE_CAL_ADAPTER(user_data);
- g_debug("removing instance...\n");
+ DEBUG("removing instance...\n");
g_signal_emit_by_name(adapter, "removing", GPOINTER_TO_UINT(sx_to_be_removed));
gnc_sx_instance_model_remove_sx_instances(model, sx_to_be_removed);
}
diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index 920f8498e..6a8cd48ca 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -53,6 +53,9 @@
#include "dialog-transfer.h"
#include "dialog-print-check.h"
#include "gnc-general-search.h"
+#include <qoflog.h>
+
+static const QofLogModule log_module = G_LOG_DOMAIN;
#define DIALOG_PAYMENT_CM_CLASS "payment-dialog"
@@ -1561,7 +1564,7 @@ gboolean gnc_ui_payment_is_customer_payment(const Transaction *txn)
{
/* Transaction isn't valid for a payment, just return the default
* Calling code will have to handle this situation properly */
- g_message("No asset splits in txn \"%s\"; cannot use this for assigning a payment.",
+ PINFO("No asset splits in txn \"%s\"; cannot use this for assigning a payment.",
xaccTransGetDescription(txn));
return result;
}
@@ -1569,7 +1572,7 @@ gboolean gnc_ui_payment_is_customer_payment(const Transaction *txn)
assetaccount_split = xaccTransGetFirstPaymentAcctSplit(txn);
amount = xaccSplitGetValue(assetaccount_split);
result = gnc_numeric_positive_p(amount); // positive amounts == customer
- //g_message("Amount=%s", gnc_numeric_to_string(amount));
+ //PINFO("Amount=%s", gnc_numeric_to_string(amount));
return result;
}
@@ -1618,7 +1621,7 @@ static Split *select_payment_split (GtkWindow *parent, Transaction *txn)
_("The selected transaction doesn't have splits that can be assigned as a payment"));
gtk_dialog_run (GTK_DIALOG(dialog));
gtk_widget_destroy (dialog);
- g_message("No asset splits in txn \"%s\"; cannot use this for assigning a payment.",
+ PINFO("No asset splits in txn \"%s\"; cannot use this for assigning a payment.",
xaccTransGetDescription(txn));
return NULL;
}
diff --git a/gnucash/gnome/dialog-print-check.c b/gnucash/gnome/dialog-print-check.c
index be56c3f0c..ad01d1d5a 100644
--- a/gnucash/gnome/dialog-print-check.c
+++ b/gnucash/gnome/dialog-print-check.c
@@ -947,7 +947,7 @@ format_read_item_placement(const gchar *file,
}
goto failed;
}
- g_debug("Check file %s, group %s, key %s, value: %s",
+ DEBUG("Check file %s, group %s, key %s, value: %s",
file, KF_GROUP_ITEMS, key, value);
g_free(key);
@@ -965,7 +965,7 @@ format_read_item_placement(const gchar *file,
if (error)
goto failed;
value = doubles_to_string(dd, dd_len);
- g_debug("Check file %s, group %s, key %s, length %"G_GSIZE_FORMAT"; values: %s",
+ DEBUG("Check file %s, group %s, key %s, length %"G_GSIZE_FORMAT"; values: %s",
file, KF_GROUP_ITEMS, key, dd_len, value);
g_free(value);
@@ -1002,7 +1002,7 @@ format_read_item_placement(const gchar *file,
g_key_file_get_string(key_file, KF_GROUP_ITEMS, key, &error);
if (!error)
{
- g_debug("Check file %s, group %s, key %s, value: %s",
+ DEBUG("Check file %s, group %s, key %s, value: %s",
file, KF_GROUP_ITEMS, key, data->font);
}
else
@@ -1020,7 +1020,7 @@ format_read_item_placement(const gchar *file,
g_key_file_get_string(key_file, KF_GROUP_ITEMS, key, &error);
if (!error)
{
- g_debug("Check file %s, group %s, key %s, value: %s",
+ DEBUG("Check file %s, group %s, key %s, value: %s",
file, KF_GROUP_ITEMS, key, value);
name = g_utf8_strdown(value, -1);
if (strcmp(name, "right") == 0)
@@ -1048,7 +1048,7 @@ format_read_item_placement(const gchar *file,
g_key_file_get_boolean(key_file, KF_GROUP_ITEMS, key, &error);
if (!error)
{
- g_debug("Check file %s, group %s, key %s, value: %d",
+ DEBUG("Check file %s, group %s, key %s, value: %d",
file, KF_GROUP_ITEMS, key, bval);
data->blocking = bval;
}
@@ -1073,7 +1073,7 @@ format_read_item_placement(const gchar *file,
&error);
if (error)
goto failed;
- g_debug("Check file %s, group %s, key %s, value: %s",
+ DEBUG("Check file %s, group %s, key %s, value: %s",
file, KF_GROUP_ITEMS, key, data->filename);
g_free(key);
break;
@@ -1084,7 +1084,7 @@ format_read_item_placement(const gchar *file,
&error);
if (error)
goto failed;
- g_debug("Check file %s, group %s, key %s, value: %s",
+ DEBUG("Check file %s, group %s, key %s, value: %s",
file, KF_GROUP_ITEMS, key, data->text);
g_free(key);
break;
@@ -1094,7 +1094,7 @@ format_read_item_placement(const gchar *file,
bval = g_key_file_get_boolean(key_file, KF_GROUP_ITEMS, key, &error);
if (!error)
{
- g_debug("Check file %s, group %s, key %s, value: %d",
+ DEBUG("Check file %s, group %s, key %s, value: %d",
file, KF_GROUP_ITEMS, key, bval);
data->print_date_format = bval;
}
@@ -1244,14 +1244,14 @@ format_read_general_info(const gchar *file,
parts = g_strsplit(value, "-", -1);
format->guid = g_strjoinv("", parts);
g_strfreev(parts);
- g_debug("Check file %s, group %s, key %s, value: %s",
+ DEBUG("Check file %s, group %s, key %s, value: %s",
file, KF_GROUP_TOP, KF_KEY_GUID, format->guid);
format->title =
g_key_file_get_string(key_file, KF_GROUP_TOP, KF_KEY_TITLE, &error);
if (!error)
{
- g_debug("Check file %s, group %s, key %s, value: %s",
+ DEBUG("Check file %s, group %s, key %s, value: %s",
file, KF_GROUP_TOP, KF_KEY_TITLE, format->title);
}
else
@@ -1266,7 +1266,7 @@ format_read_general_info(const gchar *file,
&error);
if (!error)
{
- g_debug("Check file %s, group %s, key %s, value: %d",
+ DEBUG("Check file %s, group %s, key %s, value: %d",
file, KF_GROUP_TOP, KF_KEY_BLOCKING, format->blocking);
}
else
@@ -1291,7 +1291,7 @@ format_read_general_info(const gchar *file,
&error);
if (!error)
{
- g_debug("Check file %s, group %s, key %s, value: %d",
+ DEBUG("Check file %s, group %s, key %s, value: %d",
file, KF_GROUP_TOP, KF_KEY_DATE_FORMAT, format->print_date_format);
}
else
@@ -1316,7 +1316,7 @@ format_read_general_info(const gchar *file,
&error);
if (!error)
{
- g_debug("Check file %s, group %s, key %s, value: %d",
+ DEBUG("Check file %s, group %s, key %s, value: %d",
file, KF_GROUP_TOP, KF_KEY_SHOW_GRID, format->show_grid);
}
else
@@ -1334,7 +1334,7 @@ format_read_general_info(const gchar *file,
&error);
if (!error)
{
- g_debug("Check file %s, group %s, key %s, value: %d",
+ DEBUG("Check file %s, group %s, key %s, value: %d",
file, KF_GROUP_TOP, KF_KEY_SHOW_BOXES, format->show_boxes);
}
else
@@ -1351,7 +1351,7 @@ format_read_general_info(const gchar *file,
g_key_file_get_string(key_file, KF_GROUP_TOP, KF_KEY_FONT, &error);
if (!error)
{
- g_debug("Check file %s, group %s, key %s, value: %s",
+ DEBUG("Check file %s, group %s, key %s, value: %s",
file, KF_GROUP_TOP, KF_KEY_FONT, format->font);
}
else
@@ -1367,7 +1367,7 @@ format_read_general_info(const gchar *file,
g_key_file_get_double(key_file, KF_GROUP_TOP, KF_KEY_ROTATION, &error);
if (!error)
{
- g_debug("Check file %s, group %s, key %s, value: %f",
+ DEBUG("Check file %s, group %s, key %s, value: %f",
file, KF_GROUP_TOP, KF_KEY_ROTATION, format->rotation);
}
else
@@ -1385,7 +1385,7 @@ format_read_general_info(const gchar *file,
if (!error)
{
value = doubles_to_string(dd, dd_len);
- g_debug("Check file %s, group %s, key %s, length %"G_GSIZE_FORMAT"; values: %s",
+ DEBUG("Check file %s, group %s, key %s, length %"G_GSIZE_FORMAT"; values: %s",
file, KF_GROUP_TOP, KF_KEY_TRANSLATION, dd_len, value);
g_free(value);
@@ -1867,14 +1867,14 @@ draw_text(GtkPrintContext *context, const gchar *text, check_item_t *data,
/* Clip text to the enclosing rectangle */
if (data->w && data->h)
{
- g_debug("Text clip rectangle, coords %f,%f, size %f,%f",
+ DEBUG("Text clip rectangle, coords %f,%f, size %f,%f",
data->x, data->y - data->h, data->w, data->h);
cairo_rectangle(cr, data->x, data->y - data->h, data->w, data->h);
cairo_clip_preserve(cr);
}
/* Draw the text */
- g_debug("Text move to %f,%f, print '%s'", data->x, data->y,
+ DEBUG("Text move to %f,%f, print '%s'", data->x, data->y,
text ? text : "(null)");
cairo_move_to(cr, data->x, data->y - height);
pango_cairo_show_layout(cr, layout);
@@ -1963,13 +1963,13 @@ draw_picture(GtkPrintContext *context, check_item_t *data)
if (data->w && data->h)
{
cairo_rectangle(cr, data->x, data->y - data->h, data->w, data->h);
- g_debug("Picture clip rectangle, user coords %f,%f, user size %f,%f",
+ DEBUG("Picture clip rectangle, user coords %f,%f, user size %f,%f",
data->x, data->y - data->h, data->w, data->h);
}
else
{
cairo_rectangle(cr, data->x, data->y - pix_h, pix_w, pix_h);
- g_debug("Picture clip rectangle, user coords %f,%f, pic size %d,%d",
+ DEBUG("Picture clip rectangle, user coords %f,%f, pic size %d,%d",
data->x, data->y - data->h, pix_w, pix_h);
}
cairo_clip_preserve(cr);
@@ -2265,8 +2265,8 @@ draw_check_format(GtkPrintContext *context, gint position,
* need to be moved (hence the test for position > 0 above. */
cairo_translate(cr, 0, format->height); /* Translation is relative to previous
check translation, not to page border ! */
- g_debug("Position %d translated by %f relative to previous check (pre-defined)", position, format->height);
- g_debug(" by %f relative to page (pre-defined)", position * format->height);
+ DEBUG("Position %d translated by %f relative to previous check (pre-defined)", position, format->height);
+ DEBUG(" by %f relative to page (pre-defined)", position * format->height);
}
else if (position == pcd->position_max)
{
@@ -2275,10 +2275,10 @@ draw_check_format(GtkPrintContext *context, gint position,
x = multip * gtk_spin_button_get_value(pcd->translation_x);
y = multip * gtk_spin_button_get_value(pcd->translation_y);
cairo_translate(cr, x, y);
- g_debug("Position translated by %f,%f (custom)", x, y);
+ DEBUG("Position translated by %f,%f (custom)", x, y);
r = gtk_spin_button_get_value(pcd->check_rotation);
cairo_rotate(cr, r * DEGREES_TO_RADIANS);
- g_debug("Position rotated by %f degrees (custom)", r);
+ DEBUG("Position rotated by %f degrees (custom)", r);
}
/* Draw layout boxes if requested. Also useful when determining check
@@ -2317,12 +2317,12 @@ draw_check_custom(GtkPrintContext *context, gpointer user_data)
degrees = gtk_spin_button_get_value(pcd->check_rotation);
cr = gtk_print_context_get_cairo_context(context);
cairo_rotate(cr, degrees * DEGREES_TO_RADIANS);
- g_debug("Page rotated by %f degrees", degrees);
+ DEBUG("Page rotated by %f degrees", degrees);
x = multip * gtk_spin_button_get_value(pcd->translation_x);
y = multip * gtk_spin_button_get_value(pcd->translation_y);
cairo_translate(cr, x, y);
- g_debug("Page translated by %f,%f", x, y);
+ DEBUG("Page translated by %f,%f", x, y);
item.x = multip * gtk_spin_button_get_value(pcd->payee_x);
item.y = multip * gtk_spin_button_get_value(pcd->payee_y);
@@ -2438,9 +2438,9 @@ draw_page(GtkPrintOperation *operation,
/* Do page level translations/rotations */
cairo_translate(cr, format->trans_x, format->trans_y);
- g_debug("Page translated by %f,%f", format->trans_x, format->trans_y);
+ DEBUG("Page translated by %f,%f", format->trans_x, format->trans_y);
cairo_rotate(cr, format->rotation * DEGREES_TO_RADIANS);
- g_debug("Page rotated by %f degrees", format->rotation);
+ DEBUG("Page rotated by %f degrees", format->rotation);
/* The grid is useful when determining check layouts */
if (format->show_grid)
diff --git a/gnucash/gnome/dialog-sx-editor.c b/gnucash/gnome/dialog-sx-editor.c
index 1bc03a85e..b855046a4 100644
--- a/gnucash/gnome/dialog-sx-editor.c
+++ b/gnucash/gnome/dialog-sx-editor.c
@@ -364,7 +364,7 @@ gnc_sxed_check_dates_changed (GncSxEditorDialog *sxed)
sx_start_date = *xaccSchedXactionGetStartDate (sxed->sx);
sx_schedule_str = recurrenceListToString (gnc_sx_get_schedule (sxed->sx));
- g_debug ("dialog schedule [%s], sx schedule [%s]",
+ DEBUG ("dialog schedule [%s], sx schedule [%s]",
dialog_schedule_str, sx_schedule_str);
schedules_are_the_same = (strcmp (dialog_schedule_str,
@@ -1000,7 +1000,7 @@ gnc_sxed_save_sx (GncSxEditorDialog *sxed)
gnc_sx_set_schedule (sxed->sx, schedule);
{
gchar *recurrence_str = recurrenceListToCompactString (schedule);
- g_debug ("recurrences parsed [%s]", recurrence_str);
+ DEBUG ("recurrences parsed [%s]", recurrence_str);
g_free (recurrence_str);
}
@@ -1173,7 +1173,7 @@ gnc_ui_scheduled_xaction_editor_dialog_create (GtkWindow *parent,
sx);
if (dlgExists)
{
- g_debug ("dialog already exists; using that one.");
+ DEBUG ("dialog already exists; using that one.");
sxed = (GncSxEditorDialog*)dlgExists->data;
gtk_window_present (GTK_WINDOW (sxed->dialog));
g_list_free (dlgExists);
diff --git a/gnucash/gnome/dialog-sx-editor2.c b/gnucash/gnome/dialog-sx-editor2.c
index a13e8e034..5a271e4a8 100644
--- a/gnucash/gnome/dialog-sx-editor2.c
+++ b/gnucash/gnome/dialog-sx-editor2.c
@@ -421,7 +421,7 @@ gnc_sxed_check_changed (GncSxEditorDialog2 *sxed)
sx_start_date = *xaccSchedXactionGetStartDate (sxed->sx);
sx_schedule_str = recurrenceListToString (gnc_sx_get_schedule (sxed->sx));
- g_debug ("dialog schedule [%s], sx schedule [%s]",
+ DEBUG ("dialog schedule [%s], sx schedule [%s]",
dialog_schedule_str, sx_schedule_str);
schedules_are_the_same = (strcmp (dialog_schedule_str, sx_schedule_str) == 0);
@@ -485,7 +485,7 @@ check_credit_debit_balance (gpointer key,
if (gnc_numeric_zero_p (gnc_numeric_sub_fixed (tcds->debitSum,
tcds->creditSum)))
{
- g_debug ("%p | true [%s - %s = %s]",
+ DEBUG ("%p | true [%s - %s = %s]",
key,
gnc_numeric_to_string (tcds->debitSum),
gnc_numeric_to_string (tcds->creditSum),
@@ -494,7 +494,7 @@ check_credit_debit_balance (gpointer key,
}
else
{
- g_debug ("%p | false [%s - %s = %s]",
+ DEBUG ("%p | false [%s - %s = %s]",
key,
gnc_numeric_to_string (tcds->debitSum),
gnc_numeric_to_string (tcds->creditSum),
@@ -970,7 +970,7 @@ gnc_sxed_save_sx (GncSxEditorDialog2 *sxed )
gnc_sx_set_schedule (sxed->sx, schedule);
{
gchar *recurrence_str = recurrenceListToCompactString (schedule);
- g_debug("recurrences parsed [%s]", recurrence_str);
+ DEBUG("recurrences parsed [%s]", recurrence_str);
g_free (recurrence_str);
}
@@ -1122,7 +1122,7 @@ gnc_ui_scheduled_xaction_editor_dialog_create2 (GtkWindow *parent,
sx);
if (dlgExists != NULL)
{
- g_debug ("dialog already exists; using that one.");
+ DEBUG ("dialog already exists; using that one.");
sxed = (GncSxEditorDialog2*)dlgExists->data;
gtk_window_present (GTK_WINDOW (sxed->dialog));
g_list_free (dlgExists);
diff --git a/gnucash/gnome/dialog-sx-from-trans.c b/gnucash/gnome/dialog-sx-from-trans.c
index 027ab7f54..466d12e53 100644
--- a/gnucash/gnome/dialog-sx-from-trans.c
+++ b/gnucash/gnome/dialog-sx-from-trans.c
@@ -650,16 +650,16 @@ gnc_sx_trans_window_response_cb (GtkDialog *dialog,
switch (response)
{
case GTK_RESPONSE_OK:
- g_debug(" OK");
+ DEBUG(" OK");
sxftd_ok_clicked(sxfti);
break;
case SXFTD_RESPONSE_ADVANCED:
- g_debug(" ADVANCED");
+ DEBUG(" ADVANCED");
sxftd_advanced_clicked(sxfti);
break;
case GTK_RESPONSE_CANCEL:
default:
- g_debug(" CANCEL");
+ DEBUG(" CANCEL");
sxftd_close(sxfti, TRUE);
break;
diff --git a/gnucash/gnome/dialog-sx-since-last-run.c b/gnucash/gnome/dialog-sx-since-last-run.c
index a597c647d..49992a530 100644
--- a/gnucash/gnome/dialog-sx-since-last-run.c
+++ b/gnucash/gnome/dialog-sx-since-last-run.c
@@ -938,7 +938,7 @@ variable_value_changed_cb (GtkCellRendererText *cell,
gnc_numeric parsed_num;
char *endStr = NULL;
- g_debug ("variable to [%s] at path [%s]", value, path);
+ DEBUG ("variable to [%s] at path [%s]", value, path);
if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(dialog->editing_model), &tree_iter, path))
{
g_warning ("invalid path [%s]", path);
@@ -955,7 +955,7 @@ variable_value_changed_cb (GtkCellRendererText *cell,
|| gnc_numeric_check (parsed_num) != GNC_ERROR_OK)
{
gchar *value_copy = g_strdup (value);
- g_debug ("value=[%s] endStr[%s]", value, endStr);
+ DEBUG ("value=[%s] endStr[%s]", value, endStr);
if (strlen (g_strstrip (value_copy)) == 0)
{
gnc_numeric invalid_num = gnc_numeric_error (GNC_ERROR_ARG);
@@ -1155,7 +1155,7 @@ dialog_response_cb (GtkDialog *dialog, gint response_id, GncSxSinceLastRunDialog
{
GList *unbound_variables;
unbound_variables = gnc_sx_instance_model_check_variables (app_dialog->editing_model->instances);
- g_message ("%d variables unbound", g_list_length (unbound_variables));
+ PINFO ("%d variables unbound", g_list_length (unbound_variables));
if (g_list_length (unbound_variables) > 0)
{
// focus first variable
diff --git a/gnucash/gnome/gnc-plugin-business.c b/gnucash/gnome/gnc-plugin-business.c
index 11e39ff8e..5497eff32 100644
--- a/gnucash/gnome/gnc-plugin-business.c
+++ b/gnucash/gnome/gnc-plugin-business.c
@@ -821,7 +821,7 @@ static void gnc_business_assign_payment (GtkWindow *parent,
if (xaccTransCountSplits(trans) <= 1)
return;
- //g_message("Creating payment dialog with trans %p", trans);
+ //PINFO("Creating payment dialog with trans %p", trans);
gnc_ui_payment_new_with_txn(parent, owner, trans);
}
diff --git a/gnucash/gnome/gnc-plugin-page-sx-list.c b/gnucash/gnome/gnc-plugin-page-sx-list.c
index accb5d309..e9ce4b685 100644
--- a/gnucash/gnome/gnc-plugin-page-sx-list.c
+++ b/gnucash/gnome/gnc-plugin-page-sx-list.c
@@ -769,7 +769,7 @@ gnc_plugin_page_sx_list_cmd_edit (GtkAction *action, GncPluginPageSxList *page)
gppsl_update_selected_list (page, TRUE, NULL);
for (GList *list = to_edit; list != NULL; list = list->next)
{
- g_debug ("to-edit [%s]\n", xaccSchedXactionGetName ((SchedXaction*)list->data));
+ DEBUG ("to-edit [%s]\n", xaccSchedXactionGetName ((SchedXaction*)list->data));
gppsl_update_selected_list (page, FALSE, list->data);
}
@@ -877,7 +877,7 @@ gnc_plugin_page_sx_list_cmd_delete (GtkAction *action, GncPluginPageSxList *page
gppsl_update_selected_list (page, TRUE, NULL);
for (GList *list = to_delete; list != NULL; list = list->next)
{
- g_debug("to-delete [%s]\n", xaccSchedXactionGetName ((SchedXaction*)list->data));
+ DEBUG("to-delete [%s]\n", xaccSchedXactionGetName ((SchedXaction*)list->data));
gppsl_update_selected_list (page, FALSE, list->data);
}
g_list_foreach (to_delete, (GFunc)_destroy_sx, NULL);
diff --git a/gnucash/gnucash-core-app.cpp b/gnucash/gnucash-core-app.cpp
index 3269fbf17..1592f4fb6 100644
--- a/gnucash/gnucash-core-app.cpp
+++ b/gnucash/gnucash-core-app.cpp
@@ -90,7 +90,7 @@ static void
update_message(const gchar *msg)
{
gnc_update_splash_screen(msg, GNC_SPLASH_PERCENTAGE_UNKNOWN);
- g_message("%s", msg);
+ PINFO("%s", msg);
}
void
@@ -137,10 +137,6 @@ gnc_log_init (const std::vector <std::string> log_flags,
g_free (tracefilename);
}
- // set a reasonable default.
- qof_log_set_default(QOF_LOG_WARNING);
- gnc_log_default();
-
if (gnc_prefs_is_debugging_enabled())
{
qof_log_set_level ("", QOF_LOG_INFO);
diff --git a/gnucash/import-export/aqb/assistant-ab-initial.c b/gnucash/import-export/aqb/assistant-ab-initial.c
index fc65cad9c..8feda893d 100644
--- a/gnucash/import-export/aqb/assistant-ab-initial.c
+++ b/gnucash/import-export/aqb/assistant-ab-initial.c
@@ -198,7 +198,7 @@ aai_destroy_cb(GtkWidget *object, gpointer user_data)
if (info->deferred_info)
{
- g_message("Online Banking assistant is being closed but the wizard is still "
+ PINFO("Online Banking assistant is being closed but the wizard is still "
"running. Inoring.");
/* Tell child_exit_cb() that there is no assistant anymore */
diff --git a/gnucash/import-export/aqb/gnc-ab-gettrans.c b/gnucash/import-export/aqb/gnc-ab-gettrans.c
index b084aa2fb..376a92e4b 100644
--- a/gnucash/import-export/aqb/gnc-ab-gettrans.c
+++ b/gnucash/import-export/aqb/gnc-ab-gettrans.c
@@ -141,7 +141,7 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
/* Get the start and end dates for the GetTransactions job. */
if (!gettrans_dates(parent, gnc_acc, &from_date, &to_date))
{
- g_debug("gnc_ab_gettrans: gettrans_dates aborted");
+ DEBUG("gnc_ab_gettrans: gettrans_dates aborted");
goto cleanup;
}
/* Use this as a local storage for the until_time below. */
diff --git a/gnucash/import-export/aqb/gnc-ab-utils.c b/gnucash/import-export/aqb/gnc-ab-utils.c
index fbde92e58..3c6799cf1 100644
--- a/gnucash/import-export/aqb/gnc-ab-utils.c
+++ b/gnucash/import-export/aqb/gnc-ab-utils.c
@@ -192,18 +192,18 @@ gnc_AB_BANKING_new(void)
{
if (AB_Banking_HasConf3(api) == 0)
{
- g_message("gnc_AB_BANKING_new: importing aqbanking3 configuration\n");
+ PINFO("gnc_AB_BANKING_new: importing aqbanking3 configuration\n");
if (AB_Banking_ImportConf3(api) < 0)
{
- g_message("gnc_AB_BANKING_new: unable to import aqbanking3 configuration\n");
+ PINFO("gnc_AB_BANKING_new: unable to import aqbanking3 configuration\n");
}
}
else if (AB_Banking_HasConf2(api) == 0)
{
- g_message("gnc_AB_BANKING_new: importing aqbanking2 configuration\n");
+ PINFO("gnc_AB_BANKING_new: importing aqbanking2 configuration\n");
if (AB_Banking_ImportConf2(api) < 0)
{
- g_message("gnc_AB_BANKING_new: unable to import aqbanking2 configuration\n");
+ PINFO("gnc_AB_BANKING_new: unable to import aqbanking2 configuration\n");
}
}
}
@@ -291,7 +291,7 @@ gnc_ab_get_ab_account(const AB_BANKING *api, Account *gnc_acc)
/* Finding the account by code and number is suspended in AQBANKING 6 pending
* implementation of a replacement for AB_Banking_GetAccountByCodeAndNumber.
*/
- g_message("gnc_ab_get_ab_account: No AB_ACCOUNT found for UID %d, "
+ PINFO("gnc_ab_get_ab_account: No AB_ACCOUNT found for UID %d, "
"trying bank code\n", account_uid);
return NULL;
}
@@ -301,7 +301,7 @@ gnc_ab_get_ab_account(const AB_BANKING *api, Account *gnc_acc)
if (!ab_account && bankcode && *bankcode && accountid && *accountid)
{
- g_message("gnc_ab_get_ab_account: No AB_ACCOUNT found for UID %d, "
+ PINFO("gnc_ab_get_ab_account: No AB_ACCOUNT found for UID %d, "
"trying bank code\n", account_uid);
ab_account = AB_Banking_GetAccountByCodeAndNumber(api, bankcode,
accountid);
diff --git a/gnucash/import-export/aqb/gnc-plugin-aqbanking.c b/gnucash/import-export/aqb/gnc-plugin-aqbanking.c
index 935e0bc94..0683492df 100644
--- a/gnucash/import-export/aqb/gnc-plugin-aqbanking.c
+++ b/gnucash/import-export/aqb/gnc-plugin-aqbanking.c
@@ -496,7 +496,7 @@ gnc_plugin_ab_cmd_get_balance(GtkAction *action, GncMainWindowActionData *data)
account = main_window_to_account(data->window);
if (account == NULL)
{
- g_message("No AqBanking account selected");
+ PINFO("No AqBanking account selected");
LEAVE("no account");
return;
}
@@ -517,7 +517,7 @@ gnc_plugin_ab_cmd_get_transactions(GtkAction *action,
account = main_window_to_account(data->window);
if (account == NULL)
{
- g_message("No AqBanking account selected");
+ PINFO("No AqBanking account selected");
LEAVE("no account");
return;
}
@@ -538,7 +538,7 @@ gnc_plugin_ab_cmd_issue_sepatransaction(GtkAction *action,
account = main_window_to_account(data->window);
if (account == NULL)
{
- g_message("No AqBanking account selected");
+ PINFO("No AqBanking account selected");
LEAVE("no account");
return;
}
@@ -559,7 +559,7 @@ gnc_plugin_ab_cmd_issue_inttransaction(GtkAction *action,
account = main_window_to_account(data->window);
if (account == NULL)
{
- g_message("No AqBanking account selected");
+ PINFO("No AqBanking account selected");
LEAVE("no account");
return;
}
@@ -581,7 +581,7 @@ gnc_plugin_ab_cmd_issue_sepa_direct_debit(GtkAction *action,
account = main_window_to_account(data->window);
if (account == NULL)
{
- g_message("No AqBanking account selected");
+ PINFO("No AqBanking account selected");
LEAVE("no account");
return;
}
diff --git a/gnucash/import-export/bi-import/gnc-plugin-bi-import.c b/gnucash/import-export/bi-import/gnc-plugin-bi-import.c
index 7b202050c..38dcb4f2c 100644
--- a/gnucash/import-export/bi-import/gnc-plugin-bi-import.c
+++ b/gnucash/import-export/bi-import/gnc-plugin-bi-import.c
@@ -120,7 +120,7 @@ static void
gnc_plugin_bi_import_cmd_test (GtkAction *action, GncMainWindowActionData *data)
{
ENTER ("action %p, main window data %p", action, data);
- g_message ("bi_import");
+ PINFO ("bi_import");
gnc_plugin_bi_import_showGUI(GTK_WINDOW(data->window));
diff --git a/gnucash/import-export/customer-import/gnc-plugin-customer-import.c b/gnucash/import-export/customer-import/gnc-plugin-customer-import.c
index 744575530..93449a00c 100644
--- a/gnucash/import-export/customer-import/gnc-plugin-customer-import.c
+++ b/gnucash/import-export/customer-import/gnc-plugin-customer-import.c
@@ -121,7 +121,7 @@ static void
gnc_plugin_customer_import_cmd_test (GtkAction *action, GncMainWindowActionData *data)
{
ENTER ("action %p, main window data %p", action, data);
- g_message ("customer_import");
+ PINFO ("customer_import");
gnc_plugin_customer_import_showGUI (GTK_WINDOW(data->window));
diff --git a/gnucash/import-export/log-replay/gnc-log-replay.c b/gnucash/import-export/log-replay/gnc-log-replay.c
index c10124d3c..0d44e144c 100644
--- a/gnucash/import-export/log-replay/gnc-log-replay.c
+++ b/gnucash/import-export/log-replay/gnc-log-replay.c
@@ -51,8 +51,7 @@ void qof_instance_set_guid (gpointer inst, const GncGUID *guid);
/* NW: If you want a new log_module, just define
a unique string either in gnc-engine.h or
locally.*/
-/*static QofLogModule log_module = GNC_MOD_IMPORT;*/
-static QofLogModule log_module = GNC_MOD_TEST;
+static QofLogModule log_module = GNC_MOD_IMPORT;
/* fprintf (trans_log, "mod guid time_now " \
"date_entered date_posted " \
diff --git a/gnucash/import-export/test/CMakeLists.txt b/gnucash/import-export/test/CMakeLists.txt
index 7ac4fc969..9d348814f 100644
--- a/gnucash/import-export/test/CMakeLists.txt
+++ b/gnucash/import-export/test/CMakeLists.txt
@@ -48,6 +48,7 @@ set(gtest_import_backend_INCLUDE_DIRS
)
set(gtest_import_backend_LIBS
+ gnc-engine
PkgConfig::GTK3
${Boost_LIBRARIES}
${GMODULE_LDFLAGS}
diff --git a/gnucash/register/register-core/formulacell.c b/gnucash/register/register-core/formulacell.c
index ff12e0dd2..e1f46bc9d 100644
--- a/gnucash/register/register-core/formulacell.c
+++ b/gnucash/register/register-core/formulacell.c
@@ -30,9 +30,11 @@
#include "basiccell.h"
#include "formulacell.h"
+#include <qoflog.h>
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "gnc.register.core.formulacell"
+static const QofLogModule log_module = G_LOG_DOMAIN;
static void gnc_formula_cell_init( FormulaCell *fc );
@@ -83,7 +85,7 @@ void
gnc_formula_cell_set_value( FormulaCell *fc,
const char *newVal )
{
- g_debug("got value [%s]", newVal);
+ DEBUG("got value [%s]", newVal);
gnc_formula_cell_set_value_internal( &fc->cell, newVal );
}
@@ -94,7 +96,7 @@ gnc_formula_cell_enter( BasicCell *_cell,
int *start_selection,
int *end_selection )
{
- g_debug("%d, %d, %d", *cursor_position, *start_selection, *end_selection);
+ DEBUG("%d, %d, %d", *cursor_position, *start_selection, *end_selection);
*cursor_position = -1;
*start_selection = 0;
*end_selection = -1;
@@ -139,7 +141,7 @@ gnc_formula_cell_modify_verify( BasicCell *_cell,
const char *toks = "+-*/=()_:";
char *validated_newval = NULL;
- g_debug("%s, %d, %s, %d, %d, %d, %d",
+ DEBUG("%s, %d, %s, %d, %d, %d, %d",
change ? (gchar *)change : "(null)", change_len,
newval ? (gchar *)newval : "(null)", newval_len,
*cursor_position, *start_selection, *end_selection);
@@ -170,6 +172,6 @@ gnc_formula_cell_set_value_internal( BasicCell *_cell,
const char *str )
{
FormulaCell *fc = (FormulaCell*)_cell;
- g_debug("internal string: [%s]", str);
+ DEBUG("internal string: [%s]", str);
gnc_basic_cell_set_value_internal( &fc->cell, str );
}
diff --git a/gnucash/register/register-core/pricecell.c b/gnucash/register/register-core/pricecell.c
index a4de74d3d..56e9c483e 100644
--- a/gnucash/register/register-core/pricecell.c
+++ b/gnucash/register/register-core/pricecell.c
@@ -45,7 +45,9 @@
#include "basiccell.h"
#include "pricecell.h"
+#include <qoflog.h>
+static const QofLogModule log_module = G_LOG_DOMAIN;
static void gnc_price_cell_init (PriceCell *cell);
static void gnc_price_cell_set_value_internal (BasicCell *bcell,
@@ -80,7 +82,7 @@ gnc_price_cell_modify_verify (BasicCell *_cell,
const char *toks = "+-*/=()_";
char *validated_newval = NULL;
- g_debug("%s, %d, %s, %d, %d, %d, %d",
+ DEBUG("%s, %d, %s, %d, %d, %d, %d",
change ? (gchar *)change : "(null)", change_len,
newval ? (gchar *)newval : "(null)", newval_len,
*cursor_position, *start_selection, *end_selection);
diff --git a/gnucash/report/gnc-report.c b/gnucash/report/gnc-report.c
index 96727e96f..1311b768b 100644
--- a/gnucash/report/gnc-report.c
+++ b/gnucash/report/gnc-report.c
@@ -73,7 +73,7 @@ static void
update_message(const gchar *msg)
{
//gnc_update_splash_screen(msg, GNC_SPLASH_PERCENTAGE_UNKNOWN);
- g_message("%s", msg);
+ PINFO("%s", msg);
}
static void
diff --git a/libgnucash/app-utils/gfec.c b/libgnucash/app-utils/gfec.c
index fdb31e70f..049163376 100644
--- a/libgnucash/app-utils/gfec.c
+++ b/libgnucash/app-utils/gfec.c
@@ -13,11 +13,14 @@
#include "gfec.h"
#include "gnc-guile-utils.h"
#include "platform.h"
+#include <qoflog.h>
#include <glib.h>
#if COMPILER(MSVC)
# define strdup _strdup
#endif
+static const QofLogModule log_module = G_LOG_DOMAIN;
+
static SCM
gfec_string_from_utf8(void *data)
{
@@ -164,10 +167,10 @@ error_handler(const char *msg)
gboolean
gfec_try_load(const gchar *fn)
{
- g_debug("looking for %s", fn);
+ DEBUG("looking for %s", fn);
if (g_file_test(fn, G_FILE_TEST_EXISTS))
{
- g_debug("trying to load %s", fn);
+ DEBUG("trying to load %s", fn);
error_in_scm_eval = FALSE;
gfec_eval_file(fn, error_handler);
return !error_in_scm_eval;
diff --git a/libgnucash/app-utils/gnc-accounting-period.c b/libgnucash/app-utils/gnc-accounting-period.c
index bdeb06610..1e6de2c48 100644
--- a/libgnucash/app-utils/gnc-accounting-period.c
+++ b/libgnucash/app-utils/gnc-accounting-period.c
@@ -49,6 +49,7 @@
#include "qof.h"
#include "gnc-ui-util.h"
+static const QofLogModule log_module = G_LOG_DOMAIN;
static time64 gnc_accounting_period_start_time64 (GncAccountingPeriod which,
const GDate *fy_end,
const GDate *contains);
@@ -152,7 +153,7 @@ gnc_accounting_period_start_gdate (GncAccountingPeriod which,
switch (which)
{
default:
- g_message ("Undefined relative time constant %d", which);
+ PINFO ("Undefined relative time constant %d", which);
g_date_free (date);
return NULL;
@@ -187,7 +188,7 @@ gnc_accounting_period_start_gdate (GncAccountingPeriod which,
case GNC_ACCOUNTING_PERIOD_FYEAR:
if (fy_end == NULL)
{
- g_message ("Request for fisal year value but no fiscal year end value provided.");
+ PINFO ("Request for fisal year value but no fiscal year end value provided.");
g_date_free (date);
return NULL;
}
@@ -197,7 +198,7 @@ gnc_accounting_period_start_gdate (GncAccountingPeriod which,
case GNC_ACCOUNTING_PERIOD_FYEAR_PREV:
if (fy_end == NULL)
{
- g_message ("Request for fisal year value but no fiscal year end value provided.");
+ PINFO ("Request for fisal year value but no fiscal year end value provided.");
g_date_free (date);
return NULL;
}
@@ -246,7 +247,7 @@ gnc_accounting_period_end_gdate (GncAccountingPeriod which,
switch (which)
{
default:
- g_message ("Undefined relative time constant %d", which);
+ PINFO ("Undefined relative time constant %d", which);
g_date_free (date);
return 0;
@@ -281,7 +282,7 @@ gnc_accounting_period_end_gdate (GncAccountingPeriod which,
case GNC_ACCOUNTING_PERIOD_FYEAR:
if (fy_end == NULL)
{
- g_message ("Request for fisal year value but no fiscal year end value provided.");
+ PINFO ("Request for fisal year value but no fiscal year end value provided.");
g_date_free (date);
return 0;
}
@@ -291,7 +292,7 @@ gnc_accounting_period_end_gdate (GncAccountingPeriod which,
case GNC_ACCOUNTING_PERIOD_FYEAR_PREV:
if (fy_end == NULL)
{
- g_message ("Request for fisal year value but no fiscal year end value provided.");
+ PINFO ("Request for fisal year value but no fiscal year end value provided.");
g_date_free (date);
return 0;
}
diff --git a/libgnucash/app-utils/gnc-sx-instance-model.c b/libgnucash/app-utils/gnc-sx-instance-model.c
index 0066f146b..717a371f8 100644
--- a/libgnucash/app-utils/gnc-sx-instance-model.c
+++ b/libgnucash/app-utils/gnc-sx-instance-model.c
@@ -274,7 +274,7 @@ var_name_from_commodities(gnc_commodity* split_c, gnc_commodity* txn_c)
split_m ? split_m : "(null)",
txn_m ? txn_m : "(null)");
- g_debug("var_name is %s", var_name);
+ DEBUG("var_name is %s", var_name);
return var_name;
}
@@ -831,7 +831,7 @@ _find_unreferenced_vars(gchar *key,
if (cb_pair->hash == NULL ||
!g_hash_table_lookup_extended(cb_pair->hash, key, NULL, NULL))
{
- g_debug("variable [%s] not found", key);
+ DEBUG("variable [%s] not found", key);
cb_pair->list = g_list_append(cb_pair->list, key);
}
}
@@ -914,7 +914,7 @@ gnc_sx_instance_model_update_sx_instances(GncSxInstanceModel *model, SchedXactio
g_hash_table_foreach(existing->variable_names, (GHFunc)_find_unreferenced_vars, &removed_cb_data);
removed_var_names = removed_cb_data.list;
}
- g_debug("%d removed variables", g_list_length(removed_var_names));
+ DEBUG("%d removed variables", g_list_length(removed_var_names));
if (new_instances->variable_names != NULL)
{
@@ -924,7 +924,7 @@ gnc_sx_instance_model_update_sx_instances(GncSxInstanceModel *model, SchedXactio
g_hash_table_foreach(new_instances->variable_names, (GHFunc)_find_unreferenced_vars, &added_cb_data);
added_var_names = added_cb_data.list;
}
- g_debug("%d added variables", g_list_length(added_var_names));
+ DEBUG("%d added variables", g_list_length(added_var_names));
if (existing->variable_names != NULL)
{
@@ -1148,7 +1148,7 @@ split_apply_exchange_rate (Split *split, GHashTable *bindings,
if (exchange_rate_var != NULL)
{
exchange_rate = exchange_rate_var->value;
- g_debug("exchange_rate is %s", gnc_numeric_to_string (exchange_rate));
+ DEBUG("exchange_rate is %s", gnc_numeric_to_string (exchange_rate));
}
g_free (exchange_rate_var_name);
@@ -1161,7 +1161,7 @@ split_apply_exchange_rate (Split *split, GHashTable *bindings,
GNC_HOW_RND_ROUND_HALF_UP);
- g_debug("amount is %s for memo split '%s'", gnc_numeric_to_string (amt),
+ DEBUG("amount is %s for memo split '%s'", gnc_numeric_to_string (amt),
xaccSplitGetMemo (split));
xaccSplitSetAmount(split, amt); /* marks split dirty */
@@ -1191,10 +1191,10 @@ get_transaction_currency(SxTxnCreationData *creation_data,
creation_data ? creation_data->creation_errors : NULL;
if (txn_cmdty)
- g_debug("Template txn currency is %s.",
+ DEBUG("Template txn currency is %s.",
gnc_commodity_get_mnemonic (txn_cmdty));
else
- g_debug("No template txn currency.");
+ DEBUG("No template txn currency.");
for (;txn_splits; txn_splits = txn_splits->next)
{
@@ -1260,7 +1260,7 @@ create_each_transaction_helper(Transaction *template_txn, void *user_data)
new_txn = xaccTransCloneNoKvp(template_txn);
xaccTransBeginEdit(new_txn);
- g_debug("creating template txn desc [%s] for sx [%s]",
+ DEBUG("creating template txn desc [%s] for sx [%s]",
xaccTransGetDescription(new_txn),
xaccSchedXactionGetName(sx));
@@ -1320,7 +1320,7 @@ create_each_transaction_helper(Transaction *template_txn, void *user_data)
gnc_numeric final = split_apply_formulas(template_split,
creation_data);
xaccSplitSetValue(copying_split, final);
- g_debug("value is %s for memo split '%s'",
+ DEBUG("value is %s for memo split '%s'",
gnc_numeric_to_string (final),
xaccSplitGetMemo (copying_split));
if (! gnc_commodity_equal(split_cmdty, txn_cmdty))
@@ -1631,11 +1631,11 @@ gnc_sx_instance_model_summarize(GncSxInstanceModel *model, GncSxSummary *summary
void
gnc_sx_summary_print(const GncSxSummary *summary)
{
- g_message("num_instances: %d", summary->num_instances);
- g_message("num_to_create: %d", summary->num_to_create_instances);
- g_message("num_auto_create_instances: %d", summary->num_auto_create_instances);
- g_message("num_auto_create_no_notify_instances: %d", summary->num_auto_create_no_notify_instances);
- g_message("need dialog? %s", summary->need_dialog ? "true" : "false");
+ PINFO("num_instances: %d", summary->num_instances);
+ PINFO("num_to_create: %d", summary->num_to_create_instances);
+ PINFO("num_auto_create_instances: %d", summary->num_auto_create_instances);
+ PINFO("num_auto_create_no_notify_instances: %d", summary->num_auto_create_no_notify_instances);
+ PINFO("need dialog? %s", summary->need_dialog ? "true" : "false");
}
static void gnc_numeric_free(gpointer data)
@@ -1711,7 +1711,7 @@ static void add_to_hash_amount(GHashTable* hash, const GncGUID* guid, const gnc_
}
/* In case anyone wants to see this in the debug log. */
- g_debug("Adding to guid [%s] the value [%s]. Value now [%s].",
+ DEBUG("Adding to guid [%s] the value [%s]. Value now [%s].",
guidstr,
gnc_num_dbg_to_string(*amount),
gnc_num_dbg_to_string(*elem));
@@ -1724,7 +1724,7 @@ create_cashflow_helper(Transaction *template_txn, void *user_data)
GList *template_splits;
const gnc_commodity *first_cmdty = NULL;
- g_debug("Evaluating txn desc [%s] for sx [%s]",
+ DEBUG("Evaluating txn desc [%s] for sx [%s]",
xaccTransGetDescription(template_txn),
xaccSchedXactionGetName(creation_data->sx));
@@ -1748,7 +1748,7 @@ create_cashflow_helper(Transaction *template_txn, void *user_data)
/* Get the account that should be used for this split. */
if (!_get_template_split_account(creation_data->sx, template_split, &split_acct, creation_data->creation_errors))
{
- g_debug("Could not find account for split");
+ DEBUG("Could not find account for split");
break;
}
@@ -1828,7 +1828,7 @@ instantiate_cashflow_internal(const SchedXaction* sx,
if (!xaccSchedXactionGetEnabled(sx))
{
- g_debug("Skipping non-enabled SX [%s]",
+ DEBUG("Skipping non-enabled SX [%s]",
xaccSchedXactionGetName(sx));
return;
}
diff --git a/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp b/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp
index 8ee46c9ac..4ef67f06e 100644
--- a/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp
@@ -47,6 +47,7 @@ extern "C"
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "gnc.backend.file.sx"
+static const QofLogModule log_module = G_LOG_DOMAIN;
#define SX_ID "sx:id"
#define SX_NAME "sx:name"
@@ -228,7 +229,7 @@ sx_name_handler (xmlNodePtr node, gpointer sx_pdata)
struct sx_pdata* pdata = static_cast<decltype (pdata)> (sx_pdata);
SchedXaction* sx = pdata->sx;
gchar* tmp = dom_tree_to_text (node);
- g_debug ("sx named [%s]", tmp);
+ DEBUG ("sx named [%s]", tmp);
g_return_val_if_fail (tmp, FALSE);
xaccSchedXactionSetName (sx, tmp);
g_free (tmp);
@@ -392,7 +393,7 @@ _fixup_recurrence_start_dates (const GDate* sx_start_date, GList* schedule)
g_date_strftime (date_str, 127, "%x", &next);
sched_str = recurrenceToString (r);
- g_debug ("setting recurrence [%s] start date to [%s]",
+ DEBUG ("setting recurrence [%s] start date to [%s]",
sched_str, date_str);
g_free (sched_str);
}
@@ -412,7 +413,7 @@ _fixup_recurrence_start_dates (const GDate* sx_start_date, GList* schedule)
Recurrence* fixup = (Recurrence*)g_list_nth_data (schedule, 0);
g_date_strftime (date_buf, 127, "%x", sx_start_date);
recurrenceSet (fixup, 1, PERIOD_ONCE, sx_start_date, WEEKEND_ADJ_NONE);
- g_debug ("fixed up period=ONCE Recurrence to date [%s]", date_buf);
+ DEBUG ("fixed up period=ONCE Recurrence to date [%s]", date_buf);
}
}
@@ -429,7 +430,7 @@ sx_freqspec_handler (xmlNodePtr node, gpointer sx_pdata)
schedule = dom_tree_freqSpec_to_recurrences (node, pdata->book);
gnc_sx_set_schedule (sx, schedule);
debug_str = recurrenceListToString (schedule);
- g_debug ("parsed from freqspec [%s]", debug_str);
+ DEBUG ("parsed from freqspec [%s]", debug_str);
g_free (debug_str);
_fixup_recurrence_start_dates (xaccSchedXactionGetStartDate (sx), schedule);
@@ -446,7 +447,7 @@ sx_schedule_recurrence_handler (xmlNodePtr node, gpointer parsing_data)
Recurrence* r = dom_tree_to_recurrence (node);
g_return_val_if_fail (r, FALSE);
sched_str = recurrenceToString (r);
- g_debug ("parsed recurrence [%s]", sched_str);
+ DEBUG ("parsed recurrence [%s]", sched_str);
g_free (sched_str);
*schedule = g_list_append (*schedule, r);
return TRUE;
@@ -471,7 +472,7 @@ sx_recurrence_handler (xmlNodePtr node, gpointer _pdata)
return FALSE;
// g_return_val_if_fail(schedule, FALSE);
debug_str = recurrenceListToString (schedule);
- g_debug ("setting freshly-parsed schedule: [%s]", debug_str);
+ DEBUG ("setting freshly-parsed schedule: [%s]", debug_str);
g_free (debug_str);
gnc_sx_set_schedule (parsing_data->sx, schedule);
parsing_data->saw_recurrence = TRUE;
@@ -702,7 +703,7 @@ gnc_schedXaction_end_handler (gpointer data_for_children,
for (attr = tree->properties; attr != NULL; attr = attr->next)
{
xmlChar* attr_value = attr->children->content;
- g_debug ("sx attribute name[%s] value[%s]", attr->name, attr_value);
+ DEBUG ("sx attribute name[%s] value[%s]", attr->name, attr_value);
if (strcmp ((const char*)attr->name, "version") != 0)
{
g_warning ("unknown sx attribute [%s]", attr->name);
@@ -764,7 +765,7 @@ gnc_schedXaction_end_handler (gpointer data_for_children,
xmlFreeNode (tree);
return FALSE;
}
- g_debug ("template account name [%s] for SX with GncGUID [%s]",
+ DEBUG ("template account name [%s] for SX with GncGUID [%s]",
xaccAccountGetName (acct), guidstr);
/* FIXME: free existing template account.
diff --git a/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp b/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp
index 9d63ad0a5..bf095e09e 100644
--- a/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp
@@ -49,6 +49,7 @@ extern "C"
#include "sixtp-dom-parsers.h"
+static const QofLogModule log_module = G_LOG_DOMAIN;
const gchar* transaction_version_string = "2.0.0";
static void
diff --git a/libgnucash/backend/xml/sixtp.cpp b/libgnucash/backend/xml/sixtp.cpp
index ea41eb5fc..cc82f2092 100644
--- a/libgnucash/backend/xml/sixtp.cpp
+++ b/libgnucash/backend/xml/sixtp.cpp
@@ -31,6 +31,7 @@ extern "C"
#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
+#include <qoflog.h>
#ifdef _MSC_VER
typedef int ssize_t;
# define g_fopen fopen
@@ -43,6 +44,7 @@ extern "C"
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "gnc.backend.file.sixtp"
+static QofLogModule log_module = "gnc.backend.file.sixtp";
extern const gchar* gnc_v2_xml_version_string; /* see io-gncxml-v2.c */
@@ -169,7 +171,7 @@ sixtp_set_any (sixtp* tochange, int cleanup, ...)
if (!tochange)
{
- g_warning ("Null tochange passed");
+ PWARN ("Null tochange passed");
return NULL;
}
@@ -266,7 +268,7 @@ sixtp_destroy_child (gpointer key, gpointer value, gpointer user_data)
gpointer lookup_key;
gpointer lookup_value;
- g_debug ("Killing sixtp child under key <%s>", key ? (char*) key : "(null)");
+ DEBUG ("Killing sixtp child under key <%s>", key ? (char*) key : "(null)");
if (!corpses)
{
@@ -350,7 +352,7 @@ sixtp_add_some_sub_parsers (sixtp* tochange, int cleanup, ...)
handler = va_arg (ap, sixtp*);
if (!handler)
{
- g_warning ("Handler for tag %s is null",
+ PWARN ("Handler for tag %s is null",
tag ? tag : "(null)");
if (cleanup)
@@ -521,7 +523,7 @@ sixtp_sax_end_handler (void* user_data, const xmlChar* name)
necessary? */
if (g_strcmp0 (current_frame->tag, (gchar*) name) != 0)
{
- g_warning ("bad closing tag (start <%s>, end <%s>)", current_frame->tag, name);
+ PWARN ("bad closing tag (start <%s>, end <%s>)", current_frame->tag, name);
pdata->parsing_ok = FALSE;
/* See if we're just off by one and try to recover */
@@ -530,7 +532,7 @@ sixtp_sax_end_handler (void* user_data, const xmlChar* name)
pdata->stack = sixtp_pop_and_destroy_frame (pdata->stack);
current_frame = (sixtp_stack_frame*) pdata->stack->data;
parent_frame = (sixtp_stack_frame*) pdata->stack->next->data;
- g_warning ("found matching start <%s> tag up one level", name);
+ PWARN ("found matching start <%s> tag up one level", name);
}
}
@@ -566,7 +568,7 @@ sixtp_sax_end_handler (void* user_data, const xmlChar* name)
/* grab it before it goes away - we own the reference */
end_tag = current_frame->tag;
- g_debug ("Finished with end of <%s>", end_tag ? end_tag : "(null)");
+ DEBUG ("Finished with end of <%s>", end_tag ? end_tag : "(null)");
/*sixtp_print_frame_stack(pdata->stack, stderr);*/
@@ -754,7 +756,7 @@ sixtp_parse_file (sixtp* sixtp,
gchar* conv_name = g_win32_locale_filename_from_utf8 (filename);
if (!conv_name)
{
- g_warning ("Could not convert '%s' to system codepage", filename);
+ PWARN ("Could not convert '%s' to system codepage", filename);
return FALSE;
}
context = xmlCreateFileParserCtxt (conv_name);
@@ -776,7 +778,7 @@ sixtp_parser_read (void* context, char* buffer, int len)
ret = fread (&buffer[0], sizeof (char), len, (FILE*) context);
if (ret < 0)
- g_warning ("Error reading XML file");
+ PWARN ("Error reading XML file");
return ret;
}
diff --git a/libgnucash/backend/xml/test/test-xml-pricedb.cpp b/libgnucash/backend/xml/test/test-xml-pricedb.cpp
index 7bf5afe92..b5a734cc0 100644
--- a/libgnucash/backend/xml/test/test-xml-pricedb.cpp
+++ b/libgnucash/backend/xml/test/test-xml-pricedb.cpp
@@ -46,6 +46,9 @@ extern "C"
#include "io-gncxml-v2.h"
#include "test-file-stuff.h"
#include "test-stuff.h"
+#include <qoflog.h>
+
+static const QofLogModule log_module = G_LOG_DOMAIN;
static QofSession* session = NULL;
static int iter;
@@ -128,7 +131,7 @@ test_generation (void)
{
GNCPriceDB* db;
auto book = qof_book_new();
- g_message ("iter=%d", iter);
+ PINFO ("iter=%d", iter);
session = qof_session_new (book);
db = get_random_pricedb (book);
if (!db)
@@ -150,9 +153,6 @@ main (int argc, char** argv)
{
qof_init ();
cashobjects_register ();
- //qof_log_init_filename("/tmp/gnctest.trace");
- //qof_log_set_default(QOF_LOG_DETAIL);
- //qof_log_set_level(GNC_MOD_PRICE, QOF_LOG_DETAIL);
test_generation ();
print_test_results ();
qof_close ();
diff --git a/libgnucash/core-utils/gnc-glib-utils.c b/libgnucash/core-utils/gnc-glib-utils.c
index c15e1dd8d..b872e30f1 100644
--- a/libgnucash/core-utils/gnc-glib-utils.c
+++ b/libgnucash/core-utils/gnc-glib-utils.c
@@ -306,7 +306,7 @@ gnc_scm_log_msg(const gchar *msg)
}
void
-gnc_scm_log_debug(const gchar *msg)
+gnc_scm_loDEBUG(const gchar *msg)
{
g_log("gnc.scm", G_LOG_LEVEL_DEBUG, "%s", msg);
}
diff --git a/libgnucash/core-utils/gnc-glib-utils.h b/libgnucash/core-utils/gnc-glib-utils.h
index 97e36c53d..1216afd92 100644
--- a/libgnucash/core-utils/gnc-glib-utils.h
+++ b/libgnucash/core-utils/gnc-glib-utils.h
@@ -175,7 +175,7 @@ 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);
+void gnc_scm_loDEBUG(const gchar *msg);
/** @} */
diff --git a/libgnucash/engine/gnc-engine.c b/libgnucash/engine/gnc-engine.c
index fb68e4482..a8d665bdd 100644
--- a/libgnucash/engine/gnc-engine.c
+++ b/libgnucash/engine/gnc-engine.c
@@ -162,18 +162,6 @@ gnc_engine_is_initialized (void)
return (engine_is_initialized == 1) ? TRUE : FALSE;
}
-/* replicate old gnc-trace enum behaviour
- *
- * these are only here as a convenience, they could be
- * initialised elsewhere as appropriate.
- * */
-void gnc_log_default(void)
-{
- qof_log_set_default(QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_ROOT, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_TEST, QOF_LOG_DEBUG);
-}
-
void
gnc_engine_add_commit_error_callback( EngineCommitErrorCallback cb, gpointer data )
{
diff --git a/libgnucash/engine/gnc-engine.h b/libgnucash/engine/gnc-engine.h
index 80aa8b4c2..c3693a600 100644
--- a/libgnucash/engine/gnc-engine.h
+++ b/libgnucash/engine/gnc-engine.h
@@ -72,7 +72,6 @@ extern "C" {
#define GNC_MOD_PREFS "gnc.pref"
#define GNC_MOD_IMPORT "gnc.import"
#define GNC_MOD_ASSISTANT "gnc.assistant"
-#define GNC_MOD_TEST "gnc.tests"
#define GNC_MOD_BUDGET "gnc.budget"
//@}
diff --git a/libgnucash/engine/gncOwner.c b/libgnucash/engine/gncOwner.c
index 456fefdf8..c3c8b7315 100644
--- a/libgnucash/engine/gncOwner.c
+++ b/libgnucash/engine/gncOwner.c
@@ -788,13 +788,13 @@ gncOwnerCreatePaymentLotSecs (const GncOwner *owner, Transaction **preset_txn,
if (xaccTransGetCurrency(txn) != gncOwnerGetCurrency (owner))
{
- g_message("Uh oh, mismatching currency/commodity between selected transaction and owner. We fall back to manual creation of a new transaction.");
+ PINFO("Uh oh, mismatching currency/commodity between selected transaction and owner. We fall back to manual creation of a new transaction.");
xfer_split = NULL;
}
if (!xfer_split)
{
- g_message("Huh? Asset account not found anymore. Fully deleting old txn and now creating a new one.");
+ PINFO("Huh? Asset account not found anymore. Fully deleting old txn and now creating a new one.");
xaccTransBeginEdit (txn);
xaccTransDestroy (txn);
diff --git a/libgnucash/engine/qoflog.cpp b/libgnucash/engine/qoflog.cpp
index 7dafea99b..993d9c208 100644
--- a/libgnucash/engine/qoflog.cpp
+++ b/libgnucash/engine/qoflog.cpp
@@ -55,6 +55,7 @@ extern "C"
#include "qof.h"
#include "qoflog.h"
#include <string>
+#include <string_view>
#include <vector>
#include <memory>
#include <algorithm>
@@ -79,9 +80,11 @@ using MEVec = std::vector<ModuleEntryPtr>;
static constexpr int parts = 4; //Log domain parts vector preallocation size
static constexpr QofLogLevel default_level = QOF_LOG_WARNING;
+static QofLogLevel current_max{default_level};
+
struct ModuleEntry
{
- ModuleEntry(std::string name, QofLogLevel level) :
+ ModuleEntry(const std::string& name, QofLogLevel level) :
m_name{name}, m_level{level} {
m_children.reserve(parts);
}
@@ -102,19 +105,19 @@ get_modules()
}
static StrVec
-split_domain (const std::string domain)
+split_domain (const std::string_view domain)
{
StrVec domain_parts;
domain_parts.reserve(parts);
int start = 0;
auto pos = domain.find(".");
- if (pos == std::string::npos)
+ if (pos == std::string_view::npos)
{
domain_parts.emplace_back(domain);
}
else
{
- while (pos != std::string::npos)
+ while (pos != std::string_view::npos)
{
auto part_name{domain.substr(start, pos - start)};
domain_parts.emplace_back(part_name);
@@ -291,9 +294,12 @@ qof_log_shutdown (void)
void
qof_log_set_level(QofLogModule log_module, QofLogLevel level)
{
- if (!log_module || level == 0)
+ if (!log_module || level == QOF_LOG_FATAL)
return;
+ if (level > current_max)
+ current_max = level;
+
auto module_parts = split_domain(log_module);
auto module = get_modules();
for (auto part : module_parts)
@@ -321,10 +327,14 @@ qof_log_set_level(QofLogModule log_module, QofLogLevel level)
gboolean
qof_log_check(QofLogModule domain, QofLogLevel level)
{
-
+// Check the global levels
+ if (level > current_max)
+ return FALSE;
+ if (level <= default_level)
+ return TRUE;
auto module = get_modules();
- // If the level is < the default then no need to look further.
- if (level < module->m_level)
+ // If the level <= the default then no need to look further.
+ if (level <= module->m_level)
return TRUE;
if (!domain)
@@ -419,7 +429,7 @@ qof_log_parse_log_config(const char *filename)
return;
}
- g_debug("parsing log config from [%s]", filename);
+ DEBUG("parsing log config from [%s]", filename);
if (g_key_file_has_group(conf, levels_group))
{
gsize num_levels;
@@ -440,7 +450,7 @@ qof_log_parse_log_config(const char *filename)
level_str = g_key_file_get_string(conf, levels_group, logger_name, NULL);
level = qof_log_level_from_string(level_str);
- g_debug("setting log [%s] to level [%s=%d]", logger_name, level_str, level);
+ DEBUG("setting log [%s] to level [%s=%d]", logger_name, level_str, level);
qof_log_set_level(logger_name, level);
g_free(logger_name);
@@ -475,7 +485,7 @@ qof_log_parse_log_config(const char *filename)
}
value = g_key_file_get_string(conf, output_group, key, NULL);
- g_debug("setting [output].to=[%s]", value);
+ DEBUG("setting [output].to=[%s]", value);
qof_log_init_filename_special(value);
g_free(value);
}
@@ -485,14 +495,6 @@ qof_log_parse_log_config(const char *filename)
g_key_file_free(conf);
}
-void
-qof_log_set_default(QofLogLevel log_level)
-{
- qof_log_set_level("", log_level);
- qof_log_set_level("qof", log_level);
- qof_log_set_level("qof.unknown", log_level);
-}
-
const gchar*
qof_log_level_to_string(QofLogLevel log_level)
{
diff --git a/libgnucash/engine/qoflog.h b/libgnucash/engine/qoflog.h
index c4ee1dfdc..cf1ee5535 100644
--- a/libgnucash/engine/qoflog.h
+++ b/libgnucash/engine/qoflog.h
@@ -73,7 +73,7 @@
* @c "gnc.gui.plugin-pages.sx-list" or
* @c "gnc.register.gnome.cell.quickfill" are
* good examples.
- * @li Use glib-provided @c g_debug(...), @c g_message(...),
+ * @li Use glib-provided @c DEBUG(...), @c PINFO(...),
* @c g_warning(...), @c g_critical(...) and
* @c g_error(...) functions in preference to the historical qof/gnc @c
* PINFO, @c PERR (&c.) macros
@@ -170,9 +170,6 @@ const gchar * qof_log_prettify (const gchar *name);
* @a log_level. This implements the "log.path.hierarchy" logic. **/
gboolean qof_log_check(QofLogModule log_module, QofLogLevel log_level);
-/** Set the default level for QOF-related log paths. **/
-void qof_log_set_default(QofLogLevel log_level);
-
#define PRETTY_FUNC_NAME qof_log_prettify(G_STRFUNC)
#ifdef _MSC_VER
@@ -203,36 +200,36 @@ void qof_log_set_default(QofLogLevel log_level);
} while (0)
/** Print an informational note */
-#define PINFO(format, ...) do { \
+#define PINFO(format, ...) \
+ if (qof_log_check(log_module, QOF_LOG_INFO) { \
g_log (log_module, G_LOG_LEVEL_INFO, \
"[%s] " format, PRETTY_FUNC_NAME , __VA_ARGS__); \
-} while (0)
+}
/** Print a debugging message */
-#define DEBUG(format, ...) do { \
- g_log (log_module, G_LOG_LEVEL_DEBUG, \
- "[%s] " format, PRETTY_FUNC_NAME , __VA_ARGS__); \
-} while (0)
+#define DEBUG(format, ...) \
+ if (qof_log_check(log_module, QOF_LOG_DEBUG) { \
+ g_log (log_module, G_LOG_LEVEL_DEBUG, \
+ "[%s] " format, PRETTY_FUNC_NAME , __VA_ARGS__); \
+}
/** Print a function entry debugging message */
-#define ENTER(format, ...) do { \
- if (qof_log_check(log_module, (QofLogLevel)G_LOG_LEVEL_DEBUG)) { \
+#define ENTER(format, ...) \
+ if (qof_log_check(log_module, QOFLOG_DEBUG)) { \
g_log (log_module, G_LOG_LEVEL_DEBUG, \
"[enter %s:%s()] " format, __FILE__, \
PRETTY_FUNC_NAME , __VA_ARGS__); \
qof_log_indent(); \
- } \
-} while (0)
+}
/** Print a function exit debugging message. **/
-#define LEAVE(format, ...) do { \
- if (qof_log_check(log_module, (QofLogLevel)G_LOG_LEVEL_DEBUG)) { \
+#define LEAVE(format, ...) \
+ if (qof_log_check(log_module, QOF_LOG_DEBUG)) { \
qof_log_dedent(); \
g_log (log_module, G_LOG_LEVEL_DEBUG, \
"[leave %s()] " format, \
PRETTY_FUNC_NAME , __VA_ARGS__); \
- } \
-} while (0)
+}
#else /* _MSC_VER */
@@ -255,35 +252,39 @@ void qof_log_set_default(QofLogLevel log_level);
} while (0)
/** Print an informational note */
-#define PINFO(format, args...) do { \
- g_log (log_module, G_LOG_LEVEL_INFO, \
- "[%s] " format, PRETTY_FUNC_NAME , ## args); \
+#define PINFO(format, args...) do { \
+ if (qof_log_check(log_module, QOF_LOG_INFO)) { \
+ g_log (log_module, G_LOG_LEVEL_INFO, \
+ "[%s] " format, PRETTY_FUNC_NAME , ## args); \
+ } \
} while (0)
/** Print a debugging message */
-#define DEBUG(format, args...) do { \
- g_log (log_module, G_LOG_LEVEL_DEBUG, \
- "[%s] " format, PRETTY_FUNC_NAME , ## args); \
-} while (0)
+#define DEBUG(format, args...) do { \
+ if (qof_log_check(log_module, QOF_LOG_DEBUG)) { \
+ g_log (log_module, G_LOG_LEVEL_DEBUG, \
+ "[%s] " format, PRETTY_FUNC_NAME , ## args); \
+ } \
+} while(0)
/** Print a function entry debugging message */
-#define ENTER(format, args...) do { \
- if (qof_log_check(log_module, (QofLogLevel)G_LOG_LEVEL_DEBUG)) { \
- g_log (log_module, G_LOG_LEVEL_DEBUG, \
- "[enter %s:%s()] " format, __FILE__, \
- PRETTY_FUNC_NAME , ## args); \
- qof_log_indent(); \
+#define ENTER(format, args...) do { \
+ if (qof_log_check(log_module, QOF_LOG_DEBUG)) { \
+ g_log (log_module, G_LOG_LEVEL_DEBUG, \
+ "[enter %s:%s()] " format, __FILE__, \
+ PRETTY_FUNC_NAME , ## args); \
+ qof_log_indent(); \
} \
} while (0)
/** Print a function exit debugging message. **/
-#define LEAVE(format, args...) do { \
- if (qof_log_check(log_module, (QofLogLevel)G_LOG_LEVEL_DEBUG)) { \
- qof_log_dedent(); \
- g_log (log_module, G_LOG_LEVEL_DEBUG, \
- "[leave %s()] " format, \
- PRETTY_FUNC_NAME , ## args); \
- } \
+#define LEAVE(format, args...) do { \
+ if (qof_log_check(log_module, QOF_LOG_DEBUG)) { \
+ qof_log_dedent(); \
+ g_log (log_module, G_LOG_LEVEL_DEBUG, \
+ "[leave %s()] " format, \
+ PRETTY_FUNC_NAME , ## args); \
+ } \
} while (0)
#endif /* _MSC_VER */
diff --git a/libgnucash/engine/qofquery.cpp b/libgnucash/engine/qofquery.cpp
index 3412f9160..c17261896 100644
--- a/libgnucash/engine/qofquery.cpp
+++ b/libgnucash/engine/qofquery.cpp
@@ -1509,9 +1509,8 @@ static void qof_query_printValueForParam (QofQueryPredData *pd, GString * gs);
static void qof_query_printOutput (GList * output);
/** \deprecated access via qof_log instead.
- The query will be logged automatically if qof_log_set_default
- or qof_log_set_level(QOF_MOD_QUERY, ...) are set to QOF_LOG_DEBUG
- or higher.
+ The query will be logged automatically if
+ qof_log_set_level(QOF_MOD_QUERY, ...) is set to QOF_LOG_DEBUG.
This function cycles through a QofQuery object, and
prints out the values of the various members of the query
diff --git a/libgnucash/engine/qofquery.h b/libgnucash/engine/qofquery.h
index 1f7a0acac..0af32384c 100644
--- a/libgnucash/engine/qofquery.h
+++ b/libgnucash/engine/qofquery.h
@@ -372,7 +372,6 @@ gboolean qof_query_equal (const QofQuery *q1, const QofQuery *q2);
*
* \deprecated Do not call directly, use the standard log
* module code: ::qof_log_set_level(QOF_MOD_QUERY, QOF_LOG_DEBUG);
- * or ::qof_log_set_default(QOF_LOG_DEBUG);
*/
void qof_query_print (QofQuery *query);
diff --git a/libgnucash/engine/test/utest-Transaction.cpp b/libgnucash/engine/test/utest-Transaction.cpp
index 620983d39..8e7ab027f 100644
--- a/libgnucash/engine/test/utest-Transaction.cpp
+++ b/libgnucash/engine/test/utest-Transaction.cpp
@@ -774,6 +774,7 @@ test_xaccTransEqual (Fixture *fixture, gconstpointer pData)
auto check3 = test_error_struct_new(logdomain, loglevel, "");
auto cleanup = test_error_struct_new (logdomain, loglevel, "");
auto split0 = xaccTransGetSplit (txn0, 0);
+ qof_log_set_level (GNC_MOD_ENGINE, QOF_LOG_INFO);
test_add_error (check);
test_add_error (check2);
test_add_error (cleanup);
@@ -1322,6 +1323,7 @@ test_xaccTransBeginEdit ()
auto check2 = test_error_struct_new (logdomain, loglevel, msg2);
guint hdlr = g_log_set_handler (logdomain, loglevel,
(GLogFunc)test_list_handler, NULL);
+ qof_log_set_level (logdomain, QOF_LOG_INFO);
test_add_error (check1);
test_add_error (check2);
diff --git a/libgnucash/gnc-module/example/gnc-plugin.example.c b/libgnucash/gnc-module/example/gnc-plugin.example.c
index 1b305a20e..169e11596 100644
--- a/libgnucash/gnc-module/example/gnc-plugin.example.c
+++ b/libgnucash/gnc-module/example/gnc-plugin.example.c
@@ -102,6 +102,6 @@ static void
gnc_plugin_example_cmd_test (GtkAction *action, GncMainWindowActionData *data)
{
ENTER ("action %p, main window data %p", action, data);
- g_message ("example");
+ PINFO ("example");
LEAVE (" ");
}
Summary of changes:
bindings/core-utils.i | 2 +-
gnucash/gnome-utils/gnc-autosave.c | 26 ++++----
gnucash/gnome-utils/gnc-dense-cal.c | 35 +++++-----
gnucash/gnome-utils/gnc-frequency.c | 2 +-
gnucash/gnome-utils/gnc-gobject-utils.c | 8 ++-
gnucash/gnome-utils/gnc-main-window.c | 2 +-
.../gnc-sx-instance-dense-cal-adapter.c | 8 ++-
gnucash/gnome/dialog-payment.c | 9 ++-
gnucash/gnome/dialog-print-check.c | 58 ++++++++--------
gnucash/gnome/dialog-sx-editor.c | 6 +-
gnucash/gnome/dialog-sx-editor2.c | 10 +--
gnucash/gnome/dialog-sx-from-trans.c | 6 +-
gnucash/gnome/dialog-sx-since-last-run.c | 6 +-
gnucash/gnome/gnc-plugin-business.c | 2 +-
gnucash/gnome/gnc-plugin-page-sx-list.c | 4 +-
gnucash/gnucash-core-app.cpp | 6 +-
gnucash/import-export/aqb/assistant-ab-initial.c | 2 +-
gnucash/import-export/aqb/gnc-ab-gettrans.c | 2 +-
gnucash/import-export/aqb/gnc-ab-utils.c | 12 ++--
gnucash/import-export/aqb/gnc-plugin-aqbanking.c | 10 +--
.../import-export/bi-import/gnc-plugin-bi-import.c | 2 +-
.../customer-import/gnc-plugin-customer-import.c | 2 +-
gnucash/import-export/log-replay/gnc-log-replay.c | 3 +-
gnucash/import-export/test/CMakeLists.txt | 1 +
gnucash/register/register-core/formulacell.c | 10 +--
gnucash/register/register-core/pricecell.c | 4 +-
gnucash/report/gnc-report.c | 2 +-
libgnucash/app-utils/gfec.c | 7 +-
libgnucash/app-utils/gnc-accounting-period.c | 13 ++--
libgnucash/app-utils/gnc-sx-instance-model.c | 38 +++++------
libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp | 17 ++---
libgnucash/backend/xml/gnc-transaction-xml-v2.cpp | 1 +
libgnucash/backend/xml/sixtp.cpp | 18 ++---
libgnucash/backend/xml/test/test-xml-pricedb.cpp | 8 +--
libgnucash/core-utils/gnc-glib-utils.c | 2 +-
libgnucash/core-utils/gnc-glib-utils.h | 2 +-
libgnucash/engine/gnc-engine.c | 12 ----
libgnucash/engine/gnc-engine.h | 1 -
libgnucash/engine/gncOwner.c | 4 +-
libgnucash/engine/qoflog.cpp | 40 +++++------
libgnucash/engine/qoflog.h | 77 +++++++++++-----------
libgnucash/engine/qofquery.cpp | 5 +-
libgnucash/engine/qofquery.h | 1 -
libgnucash/engine/test/utest-Transaction.cpp | 2 +
libgnucash/gnc-module/example/gnc-plugin.example.c | 2 +-
45 files changed, 250 insertions(+), 240 deletions(-)
More information about the gnucash-changes
mailing list