r15537 - gnucash/trunk - Overhaul gnc/qof logging: Add default log handler that implements a "log4x"-style log level hierarchy. Correctly use G_LOG_DOMAIN, raw glib logging. Cleanup tests that are too loud afterwards.
Josh Sled
jsled at cvs.gnucash.org
Fri Feb 9 12:35:05 EST 2007
Author: jsled
Date: 2007-02-09 12:35:00 -0500 (Fri, 09 Feb 2007)
New Revision: 15537
Trac: http://svn.gnucash.org/trac/changeset/15537
Modified:
gnucash/trunk/lib/libqof/qof/deprecated.c
gnucash/trunk/lib/libqof/qof/kvp_frame.h
gnucash/trunk/lib/libqof/qof/qof.h
gnucash/trunk/lib/libqof/qof/qofbackend.h
gnucash/trunk/lib/libqof/qof/qofbookmerge.h
gnucash/trunk/lib/libqof/qof/qofchoice.h
gnucash/trunk/lib/libqof/qof/qofclass.h
gnucash/trunk/lib/libqof/qof/qoflog.c
gnucash/trunk/lib/libqof/qof/qoflog.h
gnucash/trunk/lib/libqof/qof/qofobject.h
gnucash/trunk/lib/libqof/qof/qofquery.h
gnucash/trunk/lib/libqof/qof/qofsession.h
gnucash/trunk/lib/libqof/qof/qofutil.c
gnucash/trunk/lib/libqof/qof/qofutil.h
gnucash/trunk/src/app-utils/Makefile.am
gnucash/trunk/src/backend/file/Makefile.am
gnucash/trunk/src/backend/file/sixtp-dom-parsers.c
gnucash/trunk/src/backend/file/test/Makefile.am
gnucash/trunk/src/backend/file/test/test-kvp-frames.c
gnucash/trunk/src/backend/file/test/test-string-converters.c
gnucash/trunk/src/backend/postgres/Makefile.am
gnucash/trunk/src/backend/postgres/test/Makefile.am
gnucash/trunk/src/backend/postgres/test/test-period.c
gnucash/trunk/src/bin/Makefile.am
gnucash/trunk/src/bin/gnucash-bin.c
gnucash/trunk/src/business/business-core/Makefile.am
gnucash/trunk/src/business/business-core/test/test-customer.c
gnucash/trunk/src/business/business-core/test/test-employee.c
gnucash/trunk/src/business/business-core/test/test-job.c
gnucash/trunk/src/business/business-core/test/test-vendor.c
gnucash/trunk/src/business/business-gnome/Makefile.am
gnucash/trunk/src/business/business-ledger/Makefile.am
gnucash/trunk/src/business/business-reports/Makefile.am
gnucash/trunk/src/business/business-utils/Makefile.am
gnucash/trunk/src/business/dialog-tax-table/Makefile.am
gnucash/trunk/src/core-utils/Makefile.am
gnucash/trunk/src/engine/Makefile.am
gnucash/trunk/src/engine/gnc-commodity.c
gnucash/trunk/src/engine/gnc-engine.c
gnucash/trunk/src/engine/gnc-engine.h
gnucash/trunk/src/engine/test/test-commodities.c
gnucash/trunk/src/engine/test/test-period.c
gnucash/trunk/src/engine/test/test-recurrence.c
gnucash/trunk/src/engine/test/test-resolve-file-path.c
gnucash/trunk/src/gnc-module/Makefile.am
gnucash/trunk/src/gnome-search/Makefile.am
gnucash/trunk/src/gnome-utils/Makefile.am
gnucash/trunk/src/gnome/Makefile.am
gnucash/trunk/src/import-export/Makefile.am
gnucash/trunk/src/import-export/hbci/Makefile.am
gnucash/trunk/src/import-export/log-replay/Makefile.am
gnucash/trunk/src/import-export/ofx/Makefile.am
gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c
gnucash/trunk/src/import-export/qif-import/Makefile.am
gnucash/trunk/src/import-export/qif-io-core/Makefile.am
gnucash/trunk/src/import-export/qif/Makefile.am
gnucash/trunk/src/network-utils/Makefile.am
gnucash/trunk/src/register/ledger-core/Makefile.am
gnucash/trunk/src/register/register-core/Makefile.am
gnucash/trunk/src/register/register-gnome/Makefile.am
gnucash/trunk/src/report/locale-specific/us/Makefile.am
gnucash/trunk/src/report/report-gnome/Makefile.am
gnucash/trunk/src/report/report-system/Makefile.am
gnucash/trunk/src/report/standard-reports/Makefile.am
gnucash/trunk/src/report/stylesheets/Makefile.am
gnucash/trunk/src/report/utility-reports/Makefile.am
Log:
Overhaul gnc/qof logging: Add default log handler that implements a "log4x"-style log level hierarchy. Correctly use G_LOG_DOMAIN, raw glib logging. Cleanup tests that are too loud afterwards.
Modified: gnucash/trunk/lib/libqof/qof/deprecated.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/deprecated.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/lib/libqof/qof/deprecated.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -31,23 +31,6 @@
an initializer, and can't be declared with 'static' because that
would give it internal linkage. (this is why it is deprecated) */
gint __attribute__ ((unused)) gnc_trace_num_spaces = 0;
-void gnc_log_init (void) { qof_log_init(); }
-void gnc_set_log_level(QofLogModule log_module, gncLogLevel level)
-{
- qof_log_set_level(log_module, (QofLogLevel)level);
-}
-void gnc_set_log_level_global(gncLogLevel level)
-{
- qof_log_set_level_registered((QofLogLevel)level);
-}
-void qof_log_set_level_global(QofLogLevel level)
-{
- qof_log_set_level_registered((QofLogLevel)level);
-}
-void gnc_set_logfile (FILE *outfile)
-{
- qof_log_set_file(outfile);
-}
const char * gnc_log_prettify (const char *name)
{
return qof_log_prettify(name);
Modified: gnucash/trunk/lib/libqof/qof/kvp_frame.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/kvp_frame.h 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/lib/libqof/qof/kvp_frame.h 2007-02-09 17:35:00 UTC (rev 15537)
@@ -65,7 +65,7 @@
#include "gnc-numeric.h"
#include "guid.h"
-#define QOF_MOD_KVP "qof-kvp"
+#define QOF_MOD_KVP "qof.kvp"
/** Opaque frame structure */
typedef struct _KvpFrame KvpFrame;
Modified: gnucash/trunk/lib/libqof/qof/qof.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qof.h 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/lib/libqof/qof/qof.h 2007-02-09 17:35:00 UTC (rev 15537)
@@ -103,7 +103,7 @@
#include "deprecated.h"
/** allow easy logging of QSF debug messages */
-#define QOF_MOD_QSF "gncqof-backend-qsf"
+#define QOF_MOD_QSF "qof.backend.qsf"
/** allow easy loading of the QSF backend */
#define QSF_BACKEND_LIB "gncqof-backend-qsf"
Modified: gnucash/trunk/lib/libqof/qof/qofbackend.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofbackend.h 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/lib/libqof/qof/qofbackend.h 2007-02-09 17:35:00 UTC (rev 15537)
@@ -46,7 +46,7 @@
#include "qofinstance.h"
-#define QOF_MOD_BACKEND "qof-backend"
+#define QOF_MOD_BACKEND "qof.backend"
/** \brief The errors that can be reported to the GUI & other front-end users
* \warning (GnuCash) If you modify QofBackendError, please update
Modified: gnucash/trunk/lib/libqof/qof/qofbookmerge.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofbookmerge.h 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/lib/libqof/qof/qofbookmerge.h 2007-02-09 17:35:00 UTC (rev 15537)
@@ -24,7 +24,7 @@
#ifndef QOFBOOKMERGE_H
#define QOFBOOKMERGE_H
-#define QOF_MOD_MERGE "qof-merge"
+#define QOF_MOD_MERGE "qof.merge"
/** @addtogroup BookMerge
Modified: gnucash/trunk/lib/libqof/qof/qofchoice.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofchoice.h 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/lib/libqof/qof/qofchoice.h 2007-02-09 17:35:00 UTC (rev 15537)
@@ -93,7 +93,7 @@
#include "qofclass.h"
#include "qofobject.h"
-#define QOF_MOD_CHOICE "qof-choice"
+#define QOF_MOD_CHOICE "qof.choice"
/** \note Choice
@{
Modified: gnucash/trunk/lib/libqof/qof/qofclass.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofclass.h 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/lib/libqof/qof/qofclass.h 2007-02-09 17:35:00 UTC (rev 15537)
@@ -71,7 +71,7 @@
#include "qofid.h"
-#define QOF_MOD_CLASS "qof-class"
+#define QOF_MOD_CLASS "qof.class"
/** \name Core types
Modified: gnucash/trunk/lib/libqof/qof/qoflog.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qoflog.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/lib/libqof/qof/qoflog.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -4,9 +4,10 @@
* Mon Nov 21 14:41:59 2005
* Author: Rob Clark (rclark at cs.hmc.edu)
* Copyright (C) 1997-2003 Linas Vepstas <linas at linas.org>
- * Copyright 2005 Neil Williams
- * linux at codehelp.co.uk
+ * Copyright 2005 Neil Williams <linux at codehelp.co.uk>
+ * Copyright 2007 Joshua Sled <jsled at asynchronous.org>
*************************************************************************** */
+
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -37,6 +38,11 @@
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
+
+#ifndef HAVE_LOCALTIME_R
+#include "localtime_r.h"
+#endif
+
#include "qof.h"
#include "qoflog.h"
@@ -46,19 +52,14 @@
static FILE *fout = NULL;
static gchar* function_buffer = NULL;
+static gint qof_log_num_spaces = 0;
static GHashTable *log_table = NULL;
-static gint qof_log_num_spaces = 0;
+static GLogFunc previous_handler = NULL;
-/* uses the enum_as_string macro.
-Lookups are done on the string. */
-AS_STRING_FUNC(QofLogLevel, LOG_LEVEL_LIST)
-
-FROM_STRING_FUNC(QofLogLevel, LOG_LEVEL_LIST)
-
void
qof_log_add_indent(void)
{
- qof_log_num_spaces += QOF_LOG_INDENT_WIDTH;
+ qof_log_num_spaces += QOF_LOG_INDENT_WIDTH;
}
gint
@@ -70,121 +71,189 @@
void
qof_log_drop_indent(void)
{
- qof_log_num_spaces = (qof_log_num_spaces < QOF_LOG_INDENT_WIDTH) ?
- 0 : qof_log_num_spaces - QOF_LOG_INDENT_WIDTH;
+ qof_log_num_spaces
+ = (qof_log_num_spaces < QOF_LOG_INDENT_WIDTH)
+ ? 0
+ : qof_log_num_spaces - QOF_LOG_INDENT_WIDTH;
}
-static void
-fh_printer (const gchar *log_domain,
- GLogLevelFlags log_level,
- const gchar *message,
- gpointer user_data)
+void
+qof_log_set_file(FILE *outfile)
{
- FILE *fh = user_data;
- fprintf (fh, "%*s%s\n", qof_log_num_spaces, "", message);
- fflush(fh);
+ if (!outfile) { fout = stderr; return; }
+ fout = outfile;
}
void
-qof_log_init (void)
+qof_log_init(void)
{
- gchar *tempfile = "/tmp/qof.trace.XXXXXX";
- const gchar *fname = "/tmp/qof.trace";
+ qof_log_init_filename(NULL);
+}
- if(!fout) /* allow qof_log_set_file */
- {
- int fd;
- if ((fd = g_mkstemp(tempfile)) != -1)
- {
- g_rename(tempfile, fname);
- fout = fdopen(fd, "w");
- }
- }
+static void
+log4glib_handler(const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data)
+{
+ gboolean debug = FALSE;
+ GHashTable *log_levels = (GHashTable*)user_data;
+ gchar *domain_copy = g_strdup(log_domain == NULL ? "" : log_domain);
+ gchar *dot_pointer = domain_copy;
+ static const QofLogLevel default_log_thresh = QOF_LOG_WARNING;
+ QofLogLevel longest_match_level = default_log_thresh;
- if(!fout)
- fout = stderr;
+ {
+ gpointer match_level;
+ if ((match_level = g_hash_table_lookup(log_levels, "")) != NULL)
+ longest_match_level = (QofLogLevel)GPOINTER_TO_INT(match_level);
+ }
- g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_MASK, fh_printer, fout);
+ if (debug) { printf("trying [%s] (%d):", log_domain, g_hash_table_size(log_levels)); }
+ if (log_levels)
+ {
+ // e.g., "a.b.c" -> "a\0b.c" -> "a.b\0c", "a.b.c"
+ gpointer match_level;
+ while ((dot_pointer = g_strstr_len(dot_pointer, strlen(dot_pointer), ".")) != NULL)
+ {
+ *dot_pointer = '\0';
+ if (debug) { printf(" [%s]", domain_copy); }
+ if (g_hash_table_lookup_extended(log_levels, domain_copy, NULL, &match_level))
+ {
+ longest_match_level = (QofLogLevel)GPOINTER_TO_INT(match_level);
+ if (debug) printf("*");
+ }
+ *dot_pointer = '.';
+ dot_pointer++;
+ }
+
+ if (debug) { printf(" [%s]", domain_copy); }
+ if (g_hash_table_lookup_extended(log_levels, domain_copy, NULL, &match_level))
+ {
+ longest_match_level = (QofLogLevel)GPOINTER_TO_INT(match_level);
+ if (debug) { printf("*"); }
+ }
+ }
+ if (debug) { printf(" found [%d]\n", longest_match_level); }
+ g_free(domain_copy);
+
+ if (log_level <= longest_match_level)
+ {
+ gboolean last_char_is_newline;
+ char timestamp_buf[10];
+ time_t now;
+ struct tm now_tm;
+ gchar *level_str = qof_log_level_to_string(log_level);
+ now = time(NULL);
+ localtime_r(&now, &now_tm);
+ strftime(timestamp_buf, 9, "%T", &now_tm);
+
+ fprintf(fout, "* %s %*s <%s> %*s%s%s",
+ timestamp_buf,
+ 5, level_str,
+ (log_domain == NULL ? "" : log_domain),
+ 0 /*qof_log_num_spaces*/, "",
+ message,
+ (g_str_has_suffix(message, "\n") ? "" : "\n"));
+ fflush(fout);
+ }
+
+ /* chain? ignore? Only chain if it's going to be quiet...
+ else
+ {
+ // chain
+ previous_handler(log_domain, log_level, message, NULL);
+ }
+ */
}
void
-qof_log_set_level(QofLogModule log_module, QofLogLevel level)
+qof_log_init_filename(const gchar* log_filename)
{
- gchar* level_string;
+ if (log_table == NULL)
+ log_table = g_hash_table_new(g_str_hash, g_str_equal);
- if(!log_module || level == 0) { return; }
- level_string = g_strdup(QofLogLevelasString(level));
- if(!log_table)
- {
- log_table = g_hash_table_new(g_str_hash, g_str_equal);
- }
- g_hash_table_insert(log_table, (gpointer)log_module, level_string);
-}
+ // don't prevent multiple qof_log_init() calls to screw this up.
+ if (!log_filename && fout == NULL)
+ {
+ fout = stderr;
+ }
+ else
+ {
+ int fd;
+ gchar *fname;
-static void
-log_module_foreach(gpointer key, gpointer value, gpointer data)
-{
- g_hash_table_insert(log_table, key, data);
+ if (fout != NULL && fout != stderr && fout != stdout)
+ fclose(fout);
+
+ fname = g_strconcat(log_filename, ".XXXXXX", NULL);
+
+ if ((fd = g_mkstemp(fname)) != -1)
+ {
+ g_rename(fname, log_filename);
+ fout = fdopen(fd, "w");
+ }
+ else
+ {
+ fout = stderr;
+ }
+ g_free(fname);
+ }
+
+ if (!fout)
+ fout = stderr;
+
+ // @@fixme really, the userdata is a struct { log_table, fout, previous_handler }
+ if (previous_handler == NULL)
+ previous_handler = g_log_set_default_handler(log4glib_handler, log_table);
}
void
-qof_log_set_level_registered(QofLogLevel level)
+qof_log_shutdown (void)
{
- gchar* level_string;
+ if (fout && fout != stderr && fout != stdout)
+ {
+ fclose(fout);
+ fout == NULL;
+ }
- if(!log_table || level == 0) { return; }
- level_string = g_strdup(QofLogLevelasString(level));
- g_hash_table_foreach(log_table, log_module_foreach, level_string);
-}
+ if (function_buffer)
+ {
+ g_free(function_buffer);
+ function_buffer = NULL;
+ }
-void
-qof_log_set_file (FILE *outfile)
-{
- if(!outfile) { fout = stderr; return; }
- fout = outfile;
+ if (log_table != NULL)
+ {
+ g_hash_table_destroy(log_table);
+ log_table = NULL;
+ }
+
+ if (previous_handler != NULL)
+ {
+ g_log_set_default_handler(previous_handler, NULL);
+ previous_handler = NULL;
+ }
}
void
-qof_log_init_filename (const gchar* logfilename)
+qof_log_set_level(QofLogModule log_module, QofLogLevel level)
{
- if(!logfilename)
+ if (!log_module || level == 0) { return; }
+ if (!log_table)
{
- fout = stderr;
+ log_table = g_hash_table_new(g_str_hash, g_str_equal);
}
- else
- {
- gchar *fname = g_strconcat(logfilename, ".XXXXXX", NULL);
- int fd;
-
- if ((fd = g_mkstemp(fname)) != -1)
- {
- g_rename(fname, logfilename);
- fout = fdopen(fd, "w");
- }
- else
- {
- fout = stderr;
- }
- g_free(fname);
- }
- qof_log_init();
+ g_hash_table_insert(log_table, (gpointer)log_module, GINT_TO_POINTER((gint)level));
}
-void
-qof_log_shutdown (void)
-{
- if(fout && fout != stderr) { fclose(fout); }
- if(function_buffer) { g_free(function_buffer); }
- g_hash_table_destroy(log_table);
-}
-
const char *
qof_log_prettify (const char *name)
{
gchar *p, *buffer;
gint length;
-
- if (!name) { return ""; }
+
+ if (!name) { return ""; }
buffer = g_strndup(name, QOF_LOG_MAX_CHARS - 1);
length = strlen(buffer);
p = g_strstr_len(buffer, length, "(");
@@ -199,6 +268,52 @@
return function_buffer;
}
+gboolean
+qof_log_check(QofLogModule log_module, QofLogLevel log_level)
+{
+ QofLogLevel level, maximum;
+ if (!log_table || log_module == NULL || log_level < 0) { return FALSE; }
+ maximum = GPOINTER_TO_INT(g_hash_table_lookup(log_table, log_module));
+ if (log_level <= maximum) { return TRUE; }
+ return FALSE;
+}
+
+void
+qof_log_set_default(QofLogLevel log_level)
+{
+ qof_log_set_level("", log_level);
+ qof_log_set_level("qof", log_level);
+}
+
+gchar*
+qof_log_level_to_string(QofLogLevel log_level)
+{
+ gchar *level_str = "unknw";
+ switch (log_level)
+ {
+ case G_LOG_LEVEL_ERROR: level_str = "ERROR"; break;
+ case G_LOG_LEVEL_CRITICAL:level_str = "CRIT"; break;
+ case G_LOG_LEVEL_WARNING: level_str = "WARN"; break;
+ case G_LOG_LEVEL_MESSAGE: level_str = "MESSG"; break;
+ case G_LOG_LEVEL_INFO: level_str = "INFO"; break;
+ case G_LOG_LEVEL_DEBUG: level_str = "DEBUG"; break;
+ default: level_str = "OTHER"; break;
+ }
+ return level_str;
+}
+
+QofLogLevel
+qof_log_level_from_string(gchar *str)
+{
+ if (g_ascii_strncasecmp("error", str, 5) == 0) return QOF_LOG_FATAL;
+ if (g_ascii_strncasecmp("crit", str, 4) == 0) return QOF_LOG_ERROR;
+ if (g_ascii_strncasecmp("warn", str, 4) == 0) return QOF_LOG_WARNING;
+ if (g_ascii_strncasecmp("mess", str, 4) == 0) return G_LOG_LEVEL_MESSAGE;
+ if (g_ascii_strncasecmp("info", str, 4) == 0) return QOF_LOG_INFO;
+ if (g_ascii_strncasecmp("debug", str, 5) == 0) return QOF_LOG_DEBUG;
+ return QOF_LOG_DEBUG;
+}
+
static
struct timeval qof_clock[NUM_CLOCKS] = {
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
@@ -316,67 +431,3 @@
fprintf (fout, "\n");
fflush (fout);
}
-
-gboolean
-qof_log_check(QofLogModule log_module, QofLogLevel log_level)
-{
- gchar* log_string;
- QofLogLevel maximum; /* Any positive log_level less than this will be logged. */
-
- log_string = NULL;
- if (log_level > QOF_LOG_TRACE) log_level = QOF_LOG_TRACE;
- if(!log_table || log_module == NULL || log_level < 0) { return FALSE; }
- log_string = (gchar*)g_hash_table_lookup(log_table, log_module);
- /* if log_module not found, do not log. */
- if(!log_string) { return FALSE; }
- maximum = QofLogLevelfromString(log_string);
- if(log_level <= maximum) { return TRUE; }
- return FALSE;
-}
-
-void qof_log_set_default(QofLogLevel log_level)
-{
- qof_log_set_level(QOF_MOD_BACKEND, log_level);
- qof_log_set_level(QOF_MOD_CLASS, log_level);
- qof_log_set_level(QOF_MOD_ENGINE, log_level);
- qof_log_set_level(QOF_MOD_OBJECT, log_level);
- qof_log_set_level(QOF_MOD_KVP, log_level);
- qof_log_set_level(QOF_MOD_MERGE, log_level);
- qof_log_set_level(QOF_MOD_QUERY, log_level);
- qof_log_set_level(QOF_MOD_SESSION, log_level);
- qof_log_set_level(QOF_MOD_CHOICE, log_level);
- qof_log_set_level(QOF_MOD_UTIL, log_level);
-}
-
-struct hash_s
-{
- QofLogCB cb;
- gpointer data;
-};
-
-static void hash_cb (gpointer key, gpointer value, gpointer data)
-{
- struct hash_s *iter;
-
- iter = (struct hash_s*)data;
- if(!iter) { return; }
- (iter->cb)(key, value, iter->data);
-}
-
-void qof_log_module_foreach(QofLogCB cb, gpointer data)
-{
- struct hash_s iter;
-
- if(!cb) { return; }
- iter.cb = cb;
- iter.data = data;
- g_hash_table_foreach(log_table, hash_cb, (gpointer)&iter);
-}
-
-gint qof_log_module_count(void)
-{
- if(!log_table) { return 0; }
- return g_hash_table_size(log_table);
-}
-
-/* ************************ END OF FILE **************************** */
Modified: gnucash/trunk/lib/libqof/qof/qoflog.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qoflog.h 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/lib/libqof/qof/qoflog.h 2007-02-09 17:35:00 UTC (rev 15537)
@@ -1,11 +1,10 @@
/***************************************************************************
* qof-log.h
*
- * Mon Nov 21 14:35:26 2005
* Author: Rob Clark (rclark at cs.hmc.edu)
* Copyright (C) 1998-2003 Linas Vepstas <linas at linas.org>
- * Copyright 2005 Neil Williams
- * linux at codehelp.co.uk
+ * Copyright 2005 Neil Williams <linux at codehelp.co.uk>
+ * Copyright 2007 Joshua Sled <jsled at asynchronous.org>
****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
@@ -36,107 +35,69 @@
#include <stdarg.h>
#include <stdio.h>
+#include <glib.h>
#include "qofutil.h"
-#define QOF_MOD_ENGINE "qof-engine"
+#define QOF_MOD_ENGINE "qof.engine"
#define LOG_LEVEL_LIST(_) \
- _(QOF_LOG_FATAL, = 0) \
- _(QOF_LOG_ERROR, = 1) \
- _(QOF_LOG_WARNING, = 2) \
- _(QOF_LOG_INFO, = 3) \
- _(QOF_LOG_DEBUG, = 4) \
- _(QOF_LOG_DETAIL, = 5) \
- _(QOF_LOG_TRACE, = 6)
+ _(QOF_LOG_FATAL, = G_LOG_LEVEL_ERROR) \
+ _(QOF_LOG_ERROR, = G_LOG_LEVEL_CRITICAL) \
+ _(QOF_LOG_WARNING, = G_LOG_LEVEL_WARNING) \
+ _(QOF_LOG_INFO, = G_LOG_LEVEL_INFO) \
+ _(QOF_LOG_DEBUG, = G_LOG_LEVEL_DEBUG) \
+ _(QOF_LOG_DETAIL, = G_LOG_LEVEL_DEBUG) \
+ _(QOF_LOG_TRACE, = G_LOG_LEVEL_DEBUG)
DEFINE_ENUM (QofLogLevel, LOG_LEVEL_LIST)
-AS_STRING_DEC(QofLogLevel, LOG_LEVEL_LIST) /**< Convert QofLogLevel to a string.
+gchar* qof_log_level_to_string(QofLogLevel lvl);
+QofLogLevel qof_log_level_from_string(gchar *str);
-The macro correlates the enum value and an
-exact copy as a string, removing the need to
-keep two separate lists in sync.
-*/
-
-FROM_STRING_DEC(QofLogLevel, LOG_LEVEL_LIST) /**< Convert the
-log_string to a QofLogLevel
-
-Only for use as a partner to ::QofLogLevelasString
-*/
-
/** indents once for each ENTER macro */
void qof_log_add_indent(void);
/** gets the running total of the indent */
gint qof_log_get_indent(void);
-/** drops back one indent for each LEAVE macro
-
-indent is reset to zero if less than a single indent would exist.
-*/
+/**
+ * drops back one indent for each LEAVE macro
+ * indent is reset to zero if less than a single indent would exist.
+ **/
void qof_log_drop_indent(void);
-/** Initialize the error logging subsystem
-
-\deprecated Applications need to call
-qof_log_set_file to set the output, otherwise
-the default of \a /tmp/qof.trace will be used.
-
-Instead, use qof_log_init_filename
-which sets the filename and initialises the
-logging subsystem in one operation.
-*/
+/**
+ * Initialize the error logging subsystem. Defaults to a level-threshold of
+ * "warning", and logging to stderr.
+ **/
void qof_log_init (void);
-/** Set the logging level of the given log_module.
-
-Registers the log_module with the qof_log hashtable and
-sets an initial value for the loglevel for that log_module.
-*/
+/**
+ * Set the logging level of the given log_module.
+ **/
void qof_log_set_level(QofLogModule module, QofLogLevel level);
-/** Set the logging level for all registered log_modules.
-
-\note Unless a log_module has been registered using
-qof_log_set_level, it will be unaffected by this change because
-there will be no entry in the hashtable.
-
-"silent" log_modules are supported by the qof_log_set_level_registered
-function which only moderates log_levels for those modules actually
-registered. The advantage is that a developer can omit existing
-log_modules from the init code and cut down the amount of unwanted logging.
-
-e.g. if you are working in one section of the code and do not want
-the extra log information created by allowing the default modules
-to log as well. This makes the log itself easier to use when working
-in a small area of the codebase. Silent log_modules can also be
-useful where no default currently exists - again to isolate certain
-sections of the default log output - and using qof_log_set_level_registered
-allows these silent log_modules to be retained in the code without
-being logged by other developers etc.
-*/
-void qof_log_set_level_registered(QofLogLevel level);
-
-/** Specify an alternate log output, to pipe or file.
-By default, all logging goes to /tmp/qof.trace
-
-Needs to be called \b before qof_log_init()
-\deprecated
-*/
+/**
+ * Specify an alternate log output, to pipe or file.
+ * Needs to be called \b before qof_log_init()
+ * \deprecated
+ **/
void qof_log_set_file (FILE *outfile);
-/** Specify a filename for log output.
-
-Calls qof_log_init() for you.
-*/
+/**
+ * Specify a filename for log output.
+ * Calls qof_log_init() for you.
+ **/
void qof_log_init_filename (const gchar* logfilename);
/** Be nice, close the logfile if possible. */
void qof_log_shutdown (void);
-/** qof_log_prettify() cleans up subroutine names. AIX/xlC has the habit
+/**
+ * qof_log_prettify() cleans up subroutine names. AIX/xlC has the habit
* of printing signatures not names; clean this up. On other operating
- * systems, truncate name to QOF_LOG_MAX_CHARS chars. */
+ * systems, truncate name to QOF_LOG_MAX_CHARS chars.
+ **/
const gchar * qof_log_prettify (const gchar *name);
/** Do not log log_modules that have not been enabled. */
@@ -148,94 +109,58 @@
typedef void (*QofLogCB) (QofLogModule log_module, QofLogLevel* log_level,
gpointer user_data);
-/** Iterate over each known log_module
+#define PRETTY_FUNC_NAME qof_log_prettify(__FUNCTION__)
-Only log_modules with log_levels set will
-be available.
-*/
-void qof_log_module_foreach(QofLogCB cb, gpointer data);
-
-/** Number of log_modules registered*/
-gint qof_log_module_count(void);
-
-#define FUNK qof_log_prettify(__FUNCTION__)
-
-/** Log error/warning/info messages to stderr or to a file.
- * This logging infrastructure is meant for validating the
- * correctness of the execution of the code. 'Info' level
- * messages help trace program flow. 'Error' messages are
- * meant to indicate internal data inconsistencies.
- *
- * Messages can be logged to stdout, stderr, or to any desired
- * file.
- */
-
/** Log a fatal error */
-#define FATAL(format, args...) do { \
- g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \
- "Fatal Error: %s(): " format, FUNK , ## args); \
+#define FATAL(format, args...) do { \
+ g_log (log_module, G_LOG_LEVEL_FATAL, \
+ "[%s()] " format, PRETTY_FUNC_NAME , ## args); \
} while (0)
/** Log a serious error */
-#define PERR(format, args...) do { \
- if (qof_log_check (log_module, QOF_LOG_ERROR)) { \
- g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
- "Error: %s(): " format, FUNK , ## args); \
- } \
+#define PERR(format, args...) do { \
+ g_log (log_module, G_LOG_LEVEL_CRITICAL, \
+ "[%s()] " format, PRETTY_FUNC_NAME , ## args); \
} while (0)
/** Log a warning */
-#define PWARN(format, args...) do { \
- if (qof_log_check (log_module, QOF_LOG_WARNING)) { \
- g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \
- "Warning: %s(): " format, FUNK , ## args); \
- } \
+#define PWARN(format, args...) do { \
+ g_log (log_module, G_LOG_LEVEL_WARNING, \
+ "[%s()] " format, PRETTY_FUNC_NAME , ## args); \
} while (0)
/** Print an informational note */
-#define PINFO(format, args...) do { \
- if (qof_log_check (log_module, QOF_LOG_INFO)) { \
- g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \
- "Info: %s(): " format, \
- FUNK , ## args); \
- } \
+#define PINFO(format, args...) do { \
+ 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 { \
- if (qof_log_check (log_module, QOF_LOG_DEBUG)) { \
- g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
- "Debug: %s(): " format, \
- FUNK , ## args); \
- } \
+#define DEBUG(format, args...) do { \
+ 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, QOF_LOG_DEBUG)) { \
- g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
- "Enter in %s: %s()" format, __FILE__, \
- FUNK , ## args); \
- qof_log_add_indent(); \
- } \
+#define ENTER(format, args...) do { \
+ g_log (log_module, G_LOG_LEVEL_DEBUG, \
+ "[enter %s:%s()] " format, __FILE__, \
+ PRETTY_FUNC_NAME , ## args); \
+ qof_log_add_indent(); \
} while (0)
/** Print a function exit debugging message */
-#define LEAVE(format, args...) do { \
- if (qof_log_check (log_module, QOF_LOG_DEBUG)) { \
- qof_log_drop_indent(); \
- g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
- "Leave: %s()" format, \
- FUNK , ## args); \
- } \
+#define LEAVE(format, args...) do { \
+ qof_log_drop_indent(); \
+ g_log (log_module, G_LOG_LEVEL_DEBUG, \
+ "[leave %s()] " format, \
+ PRETTY_FUNC_NAME , ## args); \
} while (0)
/** Print a function trace debugging message */
-#define TRACE(format, args...) do { \
- if (qof_log_check (log_module, QOF_LOG_TRACE)) { \
- g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
- "Trace: %s(): " format, FUNK , ## args); \
- } \
+#define TRACE(format, args...) do { \
+ g_log (log_module, G_LOG_LEVEL_DEBUG, \
+ "[trace %s()] " format, PRETTY_FUNC_NAME , ## args); \
} while (0)
#define DEBUGCMD(x) do { \
@@ -245,6 +170,7 @@
} while (0)
/* -------------------------------------------------------- */
+
/** Infrastructure to make timing measurements for critical pieces
* of code. Used for only for performance tuning & debugging.
*/
Modified: gnucash/trunk/lib/libqof/qof/qofobject.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofobject.h 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/lib/libqof/qof/qofobject.h 2007-02-09 17:35:00 UTC (rev 15537)
@@ -58,7 +58,7 @@
*/
#define QOF_OBJECT_VERSION 3
-#define QOF_MOD_OBJECT "qof-object"
+#define QOF_MOD_OBJECT "qof.object"
typedef struct _QofObject QofObject;
typedef void (*QofForeachCB) (gpointer obj, gpointer user_data);
Modified: gnucash/trunk/lib/libqof/qof/qofquery.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofquery.h 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/lib/libqof/qof/qofquery.h 2007-02-09 17:35:00 UTC (rev 15537)
@@ -79,7 +79,7 @@
#include "qofquerycore.h"
#include "qofchoice.h"
-#define QOF_MOD_QUERY "qof-query"
+#define QOF_MOD_QUERY "qof.query"
/** A Query */
typedef struct _QofQuery QofQuery;
Modified: gnucash/trunk/lib/libqof/qof/qofsession.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofsession.h 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/lib/libqof/qof/qofsession.h 2007-02-09 17:35:00 UTC (rev 15537)
@@ -103,7 +103,7 @@
#include "qofclass.h"
#include "qofobject.h"
-#define QOF_MOD_SESSION "qof-session"
+#define QOF_MOD_SESSION "qof.session"
/* PROTOTYPES ******************************************************/
Modified: gnucash/trunk/lib/libqof/qof/qofutil.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofutil.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/lib/libqof/qof/qofutil.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -545,6 +545,7 @@
void
qof_init (void)
{
+ qof_log_init();
qof_util_get_string_cache ();
guid_init ();
qof_object_initialize ();
@@ -559,6 +560,7 @@
qof_object_shutdown ();
guid_shutdown ();
qof_util_string_cache_destroy ();
+ qof_log_shutdown();
}
/* ************************ END OF FILE ***************************** */
Modified: gnucash/trunk/lib/libqof/qof/qofutil.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofutil.h 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/lib/libqof/qof/qofutil.h 2007-02-09 17:35:00 UTC (rev 15537)
@@ -56,7 +56,7 @@
# endif
#endif
-#define QOF_MOD_UTIL "qof-utilities"
+#define QOF_MOD_UTIL "qof.utilities"
/** \name typedef enum as string macros
@{
Modified: gnucash/trunk/src/app-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/app-utils/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/app-utils/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -126,3 +126,5 @@
CLEANFILES = ${SCM_FILE_LINKS} gnucash .scm-links
MAINTAINERCLEANFILES = swig-app-utils.c
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.app-util\"
Modified: gnucash/trunk/src/backend/file/Makefile.am
===================================================================
--- gnucash/trunk/src/backend/file/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/backend/file/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -71,3 +71,5 @@
${top_builddir}/src/core-utils/libgnc-core-utils.la \
libgnc-backend-file-utils.la \
${QOF_LIBS}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.backend.file\"
Modified: gnucash/trunk/src/backend/file/sixtp-dom-parsers.c
===================================================================
--- gnucash/trunk/src/backend/file/sixtp-dom-parsers.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/backend/file/sixtp-dom-parsers.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -475,18 +475,18 @@
/* no nodes means it's an empty string text */
if(!tree->xmlChildrenNode)
{
- PINFO ("No children");
+ DEBUG("No children");
return g_strdup("");
}
temp = (char*)xmlNodeListGetString (NULL, tree->xmlChildrenNode, TRUE);
if (!temp)
{
- PINFO ("Null string");
+ DEBUG("Null string");
return NULL;
}
- PINFO ("node string is >>>%s<<<", temp);
+ DEBUG("node string [%s]", (temp == NULL ? "(null)" : temp));
result = g_strdup (temp);
xmlFree (temp);
return result;
Modified: gnucash/trunk/src/backend/file/test/Makefile.am
===================================================================
--- gnucash/trunk/src/backend/file/test/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/backend/file/test/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -244,3 +244,5 @@
test-dom-parser1.c \
test-real-data.sh \
test-xml2-is-file.c
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.backend.file\"
Modified: gnucash/trunk/src/backend/file/test/test-kvp-frames.c
===================================================================
--- gnucash/trunk/src/backend/file/test/test-kvp-frames.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/backend/file/test/test-kvp-frames.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -215,6 +215,7 @@
int
main(int argc, char** argv)
{
+ qof_init();
test_kvp_create_delete();
test_kvp_printing();
test_kvp_frames1();
Modified: gnucash/trunk/src/backend/file/test/test-string-converters.c
===================================================================
--- gnucash/trunk/src/backend/file/test/test-string-converters.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/backend/file/test/test-string-converters.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -102,6 +102,7 @@
int
main(int argc, char **argv)
{
+ qof_log_init();
test_binary();
fflush(stdout);
test_string_converters();
Modified: gnucash/trunk/src/backend/postgres/Makefile.am
===================================================================
--- gnucash/trunk/src/backend/postgres/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/backend/postgres/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -111,3 +111,5 @@
.sql.c:
echo "\"-- DO NOT EDIT THIS FILE. IT IS AUTOGENERATED.\"" > $@
cat $< >> $@
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.backend.pg\"
Modified: gnucash/trunk/src/backend/postgres/test/Makefile.am
===================================================================
--- gnucash/trunk/src/backend/postgres/test/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/backend/postgres/test/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -76,3 +76,5 @@
EXTRA_DIST = \
db-control.sh \
run-tests.sh
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.backend.pg\"
Modified: gnucash/trunk/src/backend/postgres/test/test-period.c
===================================================================
--- gnucash/trunk/src/backend/postgres/test/test-period.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/backend/postgres/test/test-period.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -131,7 +131,8 @@
g_return_if_fail (io_err == ERR_BACKEND_NO_ERR);
qof_log_set_file (stdout);
- qof_log_set_level_registered (QOF_LOG_INFO);
+ qof_log_set_level("gnc", G_LOG_LEVEL_INFO);
+
closedbook = gnc_book_close_period (openbook, tsmiddle,
NULL, "this is opening balance dude");
Modified: gnucash/trunk/src/bin/Makefile.am
===================================================================
--- gnucash/trunk/src/bin/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/bin/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -96,3 +96,5 @@
-e 's#@-GCONF_SCHEMA_FILE_DIR-@#${GCONF_SCHEMA_FILE_DIR}#g'
mv $@.tmp $@
chmod +x $@
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.bin\"
Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/bin/gnucash-bin.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -20,7 +20,6 @@
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
* Boston, MA 02110-1301, USA gnu at gnu.org
*/
-
#include "config.h"
#include <stdlib.h>
@@ -71,7 +70,9 @@
static const char *add_quotes_file;
static int nofile;
static const char *file_to_load;
-static int loglevel;
+// static int loglevel;
+static gchar **log_flags;
+static gchar *log_to_filename;
static void
gnc_print_unstable_message(void)
@@ -94,7 +95,7 @@
static char *help_path = GNC_HELPDIR;
static void
-envt_override()
+environment_override()
{
const char *path;
@@ -202,22 +203,37 @@
GOptionEntry options[] = {
{"version", 'v', 0, G_OPTION_ARG_NONE, &gnucash_show_version,
_("Show GnuCash version"), NULL},
+
{"debug", '\0', 0, G_OPTION_ARG_NONE, &debugging,
_("Enable debugging mode"), NULL},
+
+ {"log", '\0', 0, G_OPTION_ARG_STRING_ARRAY, &log_flags,
+ _("Log level overrides, of the form \"log.ger.path={debug,info,warn,crit,error}\""),
+ _("LOG")},
+
+ {"logto", '\0', 0, G_OPTION_ARG_STRING, &log_to_filename,
+ _("File to log into; defaults to \"/tmp/gnucash.trace\"; can be \"stderr\" or \"stdout\"."),
+ _("LOGTO")},
+
+#if 0
{"loglevel", '\0', 0, G_OPTION_ARG_INT, &loglevel,
/* Translators: This is the command line option autohelp
text; see popt(3) */
- _("Set the logging level from 0 (least) to 6 (most)"),
+ _("Set the logging level from 0 (least) to 6 (most)"),
/* Translators: Argument description for autohelp; see
http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html */
_("LOGLEVEL")},
+#endif // 0
+
{"nofile", '\0', 0, G_OPTION_ARG_NONE, &nofile,
_("Do not load the last file opened"), NULL},
+
{"config-path", '\0', 0, G_OPTION_ARG_STRING, &config_path,
_("Set configuration path"),
/* Translators: Argument description for autohelp; see
http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html */
_("CONFIGPATH")},
+
{"share-path", '\0', 0, G_OPTION_ARG_STRING, &share_path,
_("Set shared data file search path"),
/* Translators: Argument description for autohelp; see
@@ -386,7 +402,7 @@
SCM main_mod;
char* fn;
GError *error = NULL;
-
+
main_mod = scm_c_resolve_module("gnucash main");
scm_set_current_module(main_mod);
@@ -407,10 +423,6 @@
before booting guile. */
gnc_main_gui_init();
- /* set a log level before trying to change it globally */
- gnc_log_default();
- qof_log_set_level_registered(loglevel);
-
gnc_hook_add_dangler(HOOK_UI_SHUTDOWN, (GFunc)gnc_file_quit, NULL);
scm_c_eval_string("(gnc:main)");
@@ -444,8 +456,68 @@
return;
}
-int main(int argc, char ** argv)
+static void
+gnc_log_init()
{
+ if (log_to_filename != NULL)
+ {
+ if (g_ascii_strcasecmp("stderr", log_to_filename) == 0)
+ {
+ qof_log_set_file(stderr);
+ }
+ else if (g_ascii_strcasecmp("stdout", log_to_filename) == 0)
+ {
+ qof_log_set_file(stdout);
+ }
+ else
+ {
+ qof_log_init_filename(log_to_filename);
+ }
+ }
+ else
+ {
+ /* initialize logging to our file. */
+ gchar *tracefilename;
+ tracefilename = g_build_filename(g_get_tmp_dir(), "gnucash.trace",
+ (gchar *)NULL);
+ qof_log_init_filename(tracefilename);
+ g_free(tracefilename);
+ }
+
+ // set a reasonable default.
+ qof_log_set_default(QOF_LOG_WARNING);
+
+ gnc_log_default();
+
+ if (log_flags != NULL)
+ {
+ int i = 0;
+ for (; log_flags[i] != NULL; i++)
+ {
+ QofLogLevel level;
+ gchar **parts = NULL;
+ gchar *logger_name = NULL;
+
+ gchar *log_opt = log_flags[i];
+ parts = g_strsplit(log_opt, "=", 2);
+ if (parts == NULL || parts[0] == NULL || parts[1] == NULL)
+ {
+ g_warning("string [%s] not parseable", log_opt);
+ continue;
+ }
+
+ logger_name = g_strdup(parts[0]);
+ level = qof_log_level_from_string(parts[1]);
+
+ qof_log_set_level(logger_name, level);
+ g_strfreev(parts);
+ }
+ }
+ }
+
+int
+main(int argc, char ** argv)
+{
gchar *localedir;
GError *binreloc_error = NULL;
@@ -463,16 +535,20 @@
#endif
g_free (localedir);
+ qof_log_init();
+ qof_log_set_default(QOF_LOG_INFO);
+
gnc_module_system_init();
- envt_override();
+ environment_override();
gnucash_command_line(&argc, argv);
gnc_print_unstable_message();
+ gnc_log_init();
if (add_quotes_file) {
gchar *prefix = gnc_path_get_prefix ();
- gchar *pkgsysconfdir = gnc_path_get_pkgsysconfdir ();
- gchar *pkgdatadir = gnc_path_get_pkgdatadir ();
- gchar *pkglibdir = gnc_path_get_pkglibdir ();
+ gchar *pkgsysconfdir = gnc_path_get_pkgsysconfdir ();
+ gchar *pkgdatadir = gnc_path_get_pkgdatadir ();
+ gchar *pkglibdir = gnc_path_get_pkglibdir ();
/* This option needs to run without a display, so we can't
initialize any GUI libraries. */
gnome_program_init(
@@ -483,10 +559,10 @@
GNOME_PARAM_APP_DATADIR, pkgdatadir,
GNOME_PARAM_APP_LIBDIR, pkglibdir,
GNOME_PARAM_NONE);
- g_free (prefix);
- g_free (pkgsysconfdir);
- g_free (pkgdatadir);
- g_free (pkglibdir);
+ g_free (prefix);
+ g_free (pkgsysconfdir);
+ g_free (pkgdatadir);
+ g_free (pkglibdir);
scm_boot_guile(argc, argv, inner_main_add_price_quotes, 0);
exit(0); /* never reached */
}
Modified: gnucash/trunk/src/business/business-core/Makefile.am
===================================================================
--- gnucash/trunk/src/business/business-core/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/business/business-core/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -98,3 +98,5 @@
noinst_DATA = .scm-links
CLEANFILES = gnucash .scm-links ${SCM_FILE_LINKS}
MAINTAINERCLEANFILES = swig-business-core.c
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.business.core\"
Modified: gnucash/trunk/src/business/business-core/test/test-customer.c
===================================================================
--- gnucash/trunk/src/business/business-core/test/test-customer.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/business/business-core/test/test-customer.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -208,6 +208,7 @@
int
main (int argc, char **argv)
{
+ qof_log_init();
guid_init ();
qof_query_init ();
qof_object_initialize ();
Modified: gnucash/trunk/src/business/business-core/test/test-employee.c
===================================================================
--- gnucash/trunk/src/business/business-core/test/test-employee.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/business/business-core/test/test-employee.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -217,7 +217,8 @@
int
main (int argc, char **argv)
-{
+{
+ qof_log_init();
guid_init ();
qof_query_init ();
qof_object_initialize ();
Modified: gnucash/trunk/src/business/business-core/test/test-job.c
===================================================================
--- gnucash/trunk/src/business/business-core/test/test-job.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/business/business-core/test/test-job.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -235,6 +235,7 @@
int
main (int argc, char **argv)
{
+ qof_log_init();
guid_init ();
qof_query_init ();
qof_object_initialize ();
Modified: gnucash/trunk/src/business/business-core/test/test-vendor.c
===================================================================
--- gnucash/trunk/src/business/business-core/test/test-vendor.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/business/business-core/test/test-vendor.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -216,6 +216,7 @@
int
main (int argc, char **argv)
{
+ qof_log_init();
guid_init ();
qof_query_init ();
qof_object_initialize ();
Modified: gnucash/trunk/src/business/business-gnome/Makefile.am
===================================================================
--- gnucash/trunk/src/business/business-gnome/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/business/business-gnome/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -117,3 +117,5 @@
noinst_DATA = .scm-links
CLEANFILES = $(BUILT_SOURCES) gnucash .scm-links ${SCM_FILE_LINKS}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.business.gnome\"
Modified: gnucash/trunk/src/business/business-ledger/Makefile.am
===================================================================
--- gnucash/trunk/src/business/business-ledger/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/business/business-ledger/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -48,3 +48,5 @@
${QOF_CFLAGS} \
${GNOME_CFLAGS} \
${GLIB_CFLAGS}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.business.ledger\"
Modified: gnucash/trunk/src/business/business-reports/Makefile.am
===================================================================
--- gnucash/trunk/src/business/business-reports/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/business/business-reports/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -35,3 +35,5 @@
CLEANFILES = .scm-links
DISTCLEANFILES = ${SCM_FILE_LINKS}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.business.reports\"
Modified: gnucash/trunk/src/business/business-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/business/business-utils/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/business/business-utils/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -66,3 +66,5 @@
CLEANFILES = .scm-links
DISTCLEANFILES = ${SCM_FILE_LINKS}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.business.utils\"
Modified: gnucash/trunk/src/business/dialog-tax-table/Makefile.am
===================================================================
--- gnucash/trunk/src/business/dialog-tax-table/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/business/dialog-tax-table/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -77,3 +77,5 @@
noinst_DATA = .scm-links
CLEANFILES = gnucash .scm-links ${SCM_FILE_LINKS}
MAINTAINERCLEANFILES = swig-dialog-tax-table.c
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.business.tax\"
Modified: gnucash/trunk/src/core-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/core-utils/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/core-utils/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -61,3 +61,5 @@
EXTRA_DIST = $(gncmod_DATA) core-utils.i
CLEANFILES = gnucash .scm-links
MAINTAINERCLEANFILES = swig-core-utils.c
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.core-utils\"
Modified: gnucash/trunk/src/engine/Makefile.am
===================================================================
--- gnucash/trunk/src/engine/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/engine/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -195,3 +195,5 @@
CLEANFILES = $(BUILT_SOURCES) gnucash .scm-links gncla-dir.h \
${SCM_FILE_LINKS}
MAINTAINERCLEANFILES = swig-engine.c
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.engine\"
Modified: gnucash/trunk/src/engine/gnc-commodity.c
===================================================================
--- gnucash/trunk/src/engine/gnc-commodity.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/engine/gnc-commodity.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -245,7 +245,7 @@
{
gnc_quote_source *new_source;
- DEBUG("Creating new source %s", source_name);
+ DEBUG("Creating new source %s", (source_name == NULL ? "(null)" : source_name));
new_source = malloc(sizeof(gnc_quote_source));
new_source->supported = supported;
new_source->type = SOURCE_UNKNOWN;
@@ -1257,7 +1257,9 @@
if (!table) return NULL;
if (!comm) return NULL;
- ENTER ("(table=%p, comm=%p) %s %s", table, comm, comm->mnemonic, comm->fullname);
+ ENTER ("(table=%p, comm=%p) %s %s", table, comm,
+ (comm->mnemonic == NULL ? "(null)" : comm->mnemonic),
+ (comm->fullname == NULL ? "(null)" : comm->fullname));
ns_name = gnc_commodity_namespace_get_name(comm->namespace);
c = gnc_commodity_table_lookup (table, ns_name, comm->mnemonic);
Modified: gnucash/trunk/src/engine/gnc-engine.c
===================================================================
--- gnucash/trunk/src/engine/gnc-engine.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/engine/gnc-engine.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -46,7 +46,7 @@
static GList * engine_init_hooks = NULL;
static int engine_is_initialized = 0;
-//static QofLogModule log_module = GNC_MOD_ENGINE;
+// static QofLogModule log_module = GNC_MOD_ENGINE;
/* GnuCash version functions */
unsigned int
@@ -85,21 +85,10 @@
{ NULL, FALSE } }, *lib;
gnc_engine_init_hook_t hook;
GList * cur;
- gchar *tracefilename;
gchar *pkglibdir;
if (1 == engine_is_initialized) return;
- /* initialize logging to our file. */
- tracefilename = g_build_filename(g_get_tmp_dir(), "gnucash.trace",
- (gchar *)NULL);
- qof_log_init_filename(tracefilename);
- g_free(tracefilename);
- /* Only set the core log_modules here the rest can be set locally. */
- qof_log_set_level(GNC_MOD_ENGINE, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_IO, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_GUI, QOF_LOG_WARNING);
- qof_log_set_default(QOF_LOG_WARNING);
/* initialize QOF */
qof_init();
qof_set_alt_dirty_mode(TRUE);
@@ -116,12 +105,12 @@
}
else
{
- g_message("failed to load %s from %s\n", lib->lib, pkglibdir);
- /* If this is a required library, stop now! */
- if (lib->required)
- {
- g_message("required library %s not found.\n", lib->lib);
- }
+ g_message("failed to load %s from %s\n", lib->lib, pkglibdir);
+ /* If this is a required library, stop now! */
+ if (lib->required)
+ {
+ g_message("required library %s not found.\n", lib->lib);
+ }
}
}
g_free (pkglibdir);
@@ -173,27 +162,7 @@
void gnc_log_default(void)
{
qof_log_set_default(QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_ENGINE, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_ACCOUNT, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_SX, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_QUERY, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_SCRUB, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_LOT, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_COMMODITY, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_BACKEND, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_PRICE, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_BUSINESS, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_IO, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_BOOK, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_GUI, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_GUILE, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_LEDGER, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_REGISTER, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_HTML, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_PREFS, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_IMPORT, QOF_LOG_WARNING);
- qof_log_set_level(GNC_MOD_DRUID, QOF_LOG_WARNING);
+ qof_log_set_level(GNC_MOD_ROOT, QOF_LOG_WARNING);
qof_log_set_level(GNC_MOD_TEST, QOF_LOG_TRACE);
- qof_log_set_level(GNC_MOD_BUDGET, QOF_LOG_WARNING);
}
Modified: gnucash/trunk/src/engine/gnc-engine.h
===================================================================
--- gnucash/trunk/src/engine/gnc-engine.h 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/engine/gnc-engine.h 2007-02-09 17:35:00 UTC (rev 15537)
@@ -41,28 +41,29 @@
/** \name QofLogModule identifiers */
// @{
-#define GNC_MOD_ENGINE "gnucash-engine-objects"
-#define GNC_MOD_ACCOUNT "gnucash-account"
-#define GNC_MOD_SX "gnucash-schedX"
-#define GNC_MOD_QUERY "gnucash-query"
-#define GNC_MOD_SCRUB "gnucash-scrub"
-#define GNC_MOD_LOT "gnucash-lots"
-#define GNC_MOD_COMMODITY "gnucash-commodity"
-#define GNC_MOD_BACKEND "gnucash-backend-general"
-#define GNC_MOD_PRICE "gnucash-pricedb"
-#define GNC_MOD_BUSINESS "gnucash-business"
-#define GNC_MOD_IO "gnucash-inputoutput"
-#define GNC_MOD_BOOK "gnucash-book-period"
-#define GNC_MOD_GUI "gnucash-gui"
-#define GNC_MOD_GUILE "gnucash-guile"
-#define GNC_MOD_LEDGER "gnucash-ledger"
-#define GNC_MOD_REGISTER "gnucash-register"
-#define GNC_MOD_HTML "gnucash-html"
-#define GNC_MOD_PREFS "gnucash-preferences"
-#define GNC_MOD_IMPORT "gnucash-import-export"
-#define GNC_MOD_DRUID "gnucash-druids"
-#define GNC_MOD_TEST "gnucash-tests"
-#define GNC_MOD_BUDGET "gnucash-budget"
+#define GNC_MOD_ROOT "gnc"
+#define GNC_MOD_ENGINE "gnc.engine"
+#define GNC_MOD_ACCOUNT "gnc.account"
+#define GNC_MOD_SX "gnc.engine.sx"
+#define GNC_MOD_QUERY "gnc.query"
+#define GNC_MOD_SCRUB "gnc.scrub"
+#define GNC_MOD_LOT "gnc.lots"
+#define GNC_MOD_COMMODITY "gnc.commodity"
+#define GNC_MOD_BACKEND "gnc.backend"
+#define GNC_MOD_PRICE "gnc.pricedb"
+#define GNC_MOD_BUSINESS "gnc.business"
+#define GNC_MOD_IO "gnc.io"
+#define GNC_MOD_BOOK "gnc.book-period"
+#define GNC_MOD_GUI "gnc.gui"
+#define GNC_MOD_GUILE "gnc.guile"
+#define GNC_MOD_LEDGER "gnc.ledger"
+#define GNC_MOD_REGISTER "gnc.register"
+#define GNC_MOD_HTML "gnc.html"
+#define GNC_MOD_PREFS "gnc.pref"
+#define GNC_MOD_IMPORT "gnc.import"
+#define GNC_MOD_DRUID "gnc.druids"
+#define GNC_MOD_TEST "gnc.tests"
+#define GNC_MOD_BUDGET "gnc.budget"
//@}
/** @brief IDENTIFIERS
Modified: gnucash/trunk/src/engine/test/test-commodities.c
===================================================================
--- gnucash/trunk/src/engine/test/test-commodities.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/engine/test/test-commodities.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -43,7 +43,7 @@
com = gnc_commodity_new(book, NULL, NULL, NULL, NULL, 0);
gnc_commodity_destroy(com);
- qof_book_destroy (book);
+ qof_book_destroy (book);
success("commodity new and destroy");
}
@@ -184,15 +184,15 @@
int
main (int argc, char **argv)
{
- guid_init ();
- qof_object_initialize ();
- qof_query_init ();
+ qof_init();
+
qof_book_register ();
gnc_commodity_table_register();
+
test_commodity();
+
print_test_results();
- qof_query_shutdown();
- guid_shutdown();
- qof_object_shutdown ();
+
+ qof_close();
return get_rv();
}
Modified: gnucash/trunk/src/engine/test/test-period.c
===================================================================
--- gnucash/trunk/src/engine/test/test-period.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/engine/test/test-period.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -119,8 +119,6 @@
tsmiddle = tsfirst;
tsmiddle.tv_sec = (tsfirst.tv_sec + tslast.tv_sec)/2;
- qof_log_set_file (stdout);
- qof_log_set_level_registered (QOF_LOG_WARNING);
closedbook = gnc_book_close_period (openbook, tsmiddle,
equity, "this is opening balance dude");
@@ -141,10 +139,8 @@
else num_trans = 120;
qof_init();
- gnc_log_default();
- qof_log_set_level(GNC_MOD_ENGINE, QOF_LOG_WARNING);
-
g_log_set_always_fatal( G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING );
+
if(cashobjects_register()) {
srand(num_trans);
run_test ();
Modified: gnucash/trunk/src/engine/test/test-recurrence.c
===================================================================
--- gnucash/trunk/src/engine/test/test-recurrence.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/engine/test/test-recurrence.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -387,6 +387,8 @@
int
main (int argc, char **argv)
{
+ qof_init();
+
g_log_set_always_fatal( G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING );
#if 0
Modified: gnucash/trunk/src/engine/test/test-resolve-file-path.c
===================================================================
--- gnucash/trunk/src/engine/test/test-resolve-file-path.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/engine/test/test-resolve-file-path.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -55,7 +55,9 @@
main(int argc, char **argv)
{
int i;
-
+
+ qof_init();
+
for(i = 0; strs[i].input != NULL; i++)
{
char *daout;
Modified: gnucash/trunk/src/gnc-module/Makefile.am
===================================================================
--- gnucash/trunk/src/gnc-module/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/gnc-module/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -54,3 +54,5 @@
CLEANFILES = .scm-links gnucash ${SCM_FILE_LINKS}
MAINTAINERCLEANFILES = swig-gnc-module.c
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.module\"
Modified: gnucash/trunk/src/gnome/Makefile.am
===================================================================
--- gnucash/trunk/src/gnome/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/gnome/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -135,3 +135,5 @@
CLEANFILES = gnucash.desktop
MAINTAINERCLEANFILES = swig-gnome.c
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.gui\"
Modified: gnucash/trunk/src/gnome-search/Makefile.am
===================================================================
--- gnucash/trunk/src/gnome-search/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/gnome-search/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -72,3 +72,4 @@
EXTRA_DIST = \
${glade_DATA}
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.gui.search\"
Modified: gnucash/trunk/src/gnome-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/gnome-utils/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/gnome-utils/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -297,3 +297,5 @@
uninstall-hook:
rm -f ${DESTDIR}${pkgdatadir}/gnome
endif
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.gui\"
Modified: gnucash/trunk/src/import-export/Makefile.am
===================================================================
--- gnucash/trunk/src/import-export/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/import-export/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -77,3 +77,5 @@
EXTRA_DIST = \
$(glade_DATA) \
generic-import-design.txt
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.i-e\"
Modified: gnucash/trunk/src/import-export/hbci/Makefile.am
===================================================================
--- gnucash/trunk/src/import-export/hbci/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/import-export/hbci/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -87,3 +87,5 @@
gnc-plugin-hbci-ui.xml
EXTRA_DIST = ${gncscm_DATA} ${libgncmod_hbci_la_empty} ${ui_DATA}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.import.hbci\"
Modified: gnucash/trunk/src/import-export/log-replay/Makefile.am
===================================================================
--- gnucash/trunk/src/import-export/log-replay/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/import-export/log-replay/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -41,3 +41,5 @@
uidir = $(GNC_UI_DIR)
dist_ui_DATA = \
gnc-plugin-log-replay-ui.xml
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.import.log-replay\"
Modified: gnucash/trunk/src/import-export/ofx/Makefile.am
===================================================================
--- gnucash/trunk/src/import-export/ofx/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/import-export/ofx/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -46,3 +46,5 @@
gnc-plugin-ofx-ui.xml
EXTRA_DIST = $(ui_DATA)
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.import.ofx\"
Modified: gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c
===================================================================
--- gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c 2007-02-09 17:35:00 UTC (rev 15537)
@@ -644,7 +644,6 @@
ofx_INFO_msg = true;
ofx_STATUS_msg = false;
- qof_log_check(GNC_MOD_IMPORT, QOF_LOG_TRACE);
DEBUG("gnc_file_ofx_import(): Begin...\n");
default_dir = gnc_get_default_directory(GCONF_SECTION);
Modified: gnucash/trunk/src/import-export/qif/Makefile.am
===================================================================
--- gnucash/trunk/src/import-export/qif/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/import-export/qif/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -36,3 +36,5 @@
${GUILE_INCS} \
${QOF_CFLAGS}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.import.qif\"
Modified: gnucash/trunk/src/import-export/qif-import/Makefile.am
===================================================================
--- gnucash/trunk/src/import-export/qif-import/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/import-export/qif-import/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -107,3 +107,5 @@
CLEANFILES += .scm-links
DISTCLEANFILES = ${SCM_FILE_LINKS}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.import.qif.import\"
Modified: gnucash/trunk/src/import-export/qif-io-core/Makefile.am
===================================================================
--- gnucash/trunk/src/import-export/qif-io-core/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/import-export/qif-io-core/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -44,3 +44,5 @@
CLEANFILES = .scm-links
DISTCLEANFILES = ${SCM_FILE_LINKS}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.import.qif.core\"
Modified: gnucash/trunk/src/network-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/network-utils/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/network-utils/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -28,3 +28,5 @@
${top_builddir}/src/gnc-module/libgnc-module.la \
${GNOME_LIBS} ${QOF_LIBS}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.net\"
Modified: gnucash/trunk/src/register/ledger-core/Makefile.am
===================================================================
--- gnucash/trunk/src/register/ledger-core/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/register/ledger-core/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -54,3 +54,6 @@
${GNOME_CFLAGS} \
${QOF_CFLAGS} \
${GLIB_CFLAGS}
+
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.register.ledger\"
Modified: gnucash/trunk/src/register/register-core/Makefile.am
===================================================================
--- gnucash/trunk/src/register/register-core/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/register/register-core/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -64,3 +64,5 @@
${GLIB_CFLAGS}
CLEANFILES = $(BUILT_SOURCES)
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.register.core\"
Modified: gnucash/trunk/src/register/register-gnome/Makefile.am
===================================================================
--- gnucash/trunk/src/register/register-gnome/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/register/register-gnome/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -65,3 +65,5 @@
${GTK_XIM_FLAGS} \
${QOF_CFLAGS} \
${GNOME_CFLAGS}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.register.gnome\"
Modified: gnucash/trunk/src/report/locale-specific/us/Makefile.am
===================================================================
--- gnucash/trunk/src/report/locale-specific/us/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/report/locale-specific/us/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -57,3 +57,5 @@
CLEANFILES = .scm-links
DISTCLEANFILES = ${SCM_FILE_LINKS}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.report.locale.us\"
Modified: gnucash/trunk/src/report/report-gnome/Makefile.am
===================================================================
--- gnucash/trunk/src/report/report-gnome/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/report/report-gnome/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -95,3 +95,5 @@
CLEANFILES = gnucash report .scm-links ${SCM_FILE_LINKS}
MAINTAINERCLEANFILES = swig-report-gnome.c
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.report.gui\"
Modified: gnucash/trunk/src/report/report-system/Makefile.am
===================================================================
--- gnucash/trunk/src/report/report-system/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/report/report-system/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -79,3 +79,5 @@
CLEANFILES = gnucash report .scm-links ${SCM_FILE_LINKS}
MAINTAINERCLEANFILES = swig-report-system.c
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.report.core\"
Modified: gnucash/trunk/src/report/standard-reports/Makefile.am
===================================================================
--- gnucash/trunk/src/report/standard-reports/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/report/standard-reports/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -66,3 +66,5 @@
CLEANFILES = .scm-links
DISTCLEANFILES = ${SCM_FILE_LINKS}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.report.standard\"
Modified: gnucash/trunk/src/report/stylesheets/Makefile.am
===================================================================
--- gnucash/trunk/src/report/stylesheets/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/report/stylesheets/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -69,3 +69,5 @@
CLEANFILES = .scm-links
DISTCLEANFILES = ${SCM_FILE_LINKS}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.report.core\"
Modified: gnucash/trunk/src/report/utility-reports/Makefile.am
===================================================================
--- gnucash/trunk/src/report/utility-reports/Makefile.am 2007-02-09 16:47:53 UTC (rev 15536)
+++ gnucash/trunk/src/report/utility-reports/Makefile.am 2007-02-09 17:35:00 UTC (rev 15537)
@@ -52,3 +52,5 @@
CLEANFILES = .scm-links
DISTCLEANFILES = ${SCM_FILE_LINKS}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.report.util\"
More information about the gnucash-changes
mailing list