[glom: 1/2] Reduce debug output.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Subject: [glom: 1/2] Reduce debug output.
- Date: Mon, 29 Jun 2009 09:39:43 +0000 (UTC)
commit f398da2fc12c2ce15bff6535dfd521d9744f1016
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Jun 29 10:47:33 2009 +0200
Reduce debug output.
* glom/libglom/data_structure/glomconversions.[h|cc]:
sanity_check_date_text_representation_uses_4_digit_years(): Make the debug
output optional.
* glom/main.cc: Added a --debug-date-check option, to avoid the debug out
about 4-digit dates normally.
* glom/dialog_existing_or_new.cc: list_examples_at_path(): Comment out debug
output.
* glom/libglom/connectionpool.cc: connect(): Comment out debug output that
showed the (previously slow) meta update calls.
ChangeLog | 15 +++++++++++++++
glom/dialog_existing_or_new.cc | 2 +-
glom/libglom/connectionpool.cc | 10 +++++-----
glom/libglom/data_structure/glomconversions.cc | 6 ++++--
glom/libglom/data_structure/glomconversions.h | 2 +-
glom/main.cc | 21 ++++++++++++++++-----
6 files changed, 42 insertions(+), 14 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c0777a5..6ecfe01 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2009-06-29 Murray Cumming <murrayc murrayc com>
+
+ Reduce debug output.
+
+ * glom/libglom/data_structure/glomconversions.[h|cc]:
+ sanity_check_date_text_representation_uses_4_digit_years(): Make the debug
+ output optional.
+ * glom/main.cc: Added a --debug-date-check option, to avoid the debug out
+ about 4-digit dates normally.
+
+ * glom/dialog_existing_or_new.cc: list_examples_at_path(): Comment out debug
+ output.
+ * glom/libglom/connectionpool.cc: connect(): Comment out debug output that
+ showed the (previously slow) meta update calls.
+
2009-06-28 Murray Cumming <murrayc murrayc com>
Print exception messages to stdout.
diff --git a/glom/dialog_existing_or_new.cc b/glom/dialog_existing_or_new.cc
index c9e7882..e0c8c94 100644
--- a/glom/dialog_existing_or_new.cc
+++ b/glom/dialog_existing_or_new.cc
@@ -241,7 +241,7 @@ Dialog_ExistingOrNew::Dialog_ExistingOrNew(BaseObjectType* cobject, const Glib::
#ifndef GLOM_ENABLE_CLIENT_ONLY
bool Dialog_ExistingOrNew::list_examples_at_path(const std::string& path)
{
- std::cout << "Dialog_ExistingOrNew::list_examples_at_path(): path=" << path << std::endl;
+ //std::cout << "Debug: Dialog_ExistingOrNew::list_examples_at_path(): path=" << path << std::endl;
m_examples_dir = Gio::File::create_for_path(path);
diff --git a/glom/libglom/connectionpool.cc b/glom/libglom/connectionpool.cc
index 7455639..ae7a310 100644
--- a/glom/libglom/connectionpool.cc
+++ b/glom/libglom/connectionpool.cc
@@ -293,7 +293,7 @@ sharedptr<SharedConnection> ConnectionPool::get_and_connect(std::auto_ptr<Except
if(!(connection_pool->m_backend.get()))
{
std::cerr << "ConnectionPool::get_and_connect(): m_backend is null." << std::endl;
- return result; //TODO: Return a FAILURE_NO_BACKEND erro?, though that would be tedious.
+ return result; //TODO: Return a FAILURE_NO_BACKEND error?, though that would be tedious.
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
@@ -385,11 +385,11 @@ sharedptr<SharedConnection> ConnectionPool::connect(std::auto_ptr<ExceptionConne
{
//Allow get_meta_store_data() to succeed:
//Hopefully this (and the update_meta_store_for_table() calls) is all we need.
- std::cout << "DEBUG: Calling update_meta_store_data_types() ..." << std::endl;
+ //std::cout << "DEBUG: Calling update_meta_store_data_types() ..." << std::endl;
m_refGdaConnection->update_meta_store_data_types();
- std::cout << "DEBUG: ... update_meta_store_data_types() has finished." << std::endl;
+ //std::cout << "DEBUG: ... update_meta_store_data_types() has finished." << std::endl;
- std::cout << "DEBUG: Calling update_meta_store_table_names() ..." << std::endl;
+ //std::cout << "DEBUG: Calling update_meta_store_table_names() ..." << std::endl;
try
{
//update_meta_store_table_names() has been known to throw an exception.
@@ -400,7 +400,7 @@ sharedptr<SharedConnection> ConnectionPool::connect(std::auto_ptr<ExceptionConne
{
std::cerr << "update_meta_store_table_names() failed: " << ex.what() << std::endl;
}
- std::cout << "DEBUG: ... update_meta_store_table_names() has finished." << std::endl;
+ //std::cout << "DEBUG: ... update_meta_store_table_names() has finished." << std::endl;
// Connection succeeded
// Create the fieldtypes member if it has not already been done:
diff --git a/glom/libglom/data_structure/glomconversions.cc b/glom/libglom/data_structure/glomconversions.cc
index 3a056b5..e041415 100644
--- a/glom/libglom/data_structure/glomconversions.cc
+++ b/glom/libglom/data_structure/glomconversions.cc
@@ -154,7 +154,7 @@ bool Conversions::sanity_check_date_parsing()
return true;
}
-bool Conversions::sanity_check_date_text_representation_uses_4_digit_years()
+bool Conversions::sanity_check_date_text_representation_uses_4_digit_years(bool debug_output)
{
//A date that is really really the date that we mean:
tm the_c_time;
@@ -167,7 +167,9 @@ bool Conversions::sanity_check_date_text_representation_uses_4_digit_years()
//Get the current locale's text representation:
const Glib::ustring date_text = format_date(the_c_time);
- std::cout << "DEBUG: 22nd November 2008 in this locale has this text represention: " << date_text << std::endl;
+
+ if(debug_output)
+ std::cout << "DEBUG: 22nd November 2008 in this locale has this text represention: " << date_text << std::endl;
//See if the year appears in full in that date.
//There are probably some locales for which this fails.
diff --git a/glom/libglom/data_structure/glomconversions.h b/glom/libglom/data_structure/glomconversions.h
index c1d632d..868de48 100644
--- a/glom/libglom/data_structure/glomconversions.h
+++ b/glom/libglom/data_structure/glomconversions.h
@@ -69,7 +69,7 @@ namespace Conversions
*
* @result true if 4 digits are used.
*/
- bool sanity_check_date_text_representation_uses_4_digit_years();
+ bool sanity_check_date_text_representation_uses_4_digit_years(bool debug_output = false);
Glib::ustring format_tm(const tm& tm_data, const std::locale& locale, const char* format);
//static tm parse_tm(const Glib::ustring& text, const std::locale& locale, char format);
diff --git a/glom/main.cc b/glom/main.cc
index f3e740e..2a81f09 100644
--- a/glom/main.cc
+++ b/glom/main.cc
@@ -78,12 +78,14 @@ public:
std::string m_arg_filename;
bool m_arg_version;
bool m_arg_debug_sql;
+ bool m_arg_debug_date_check;
};
OptionGroup::OptionGroup()
: Glib::OptionGroup("Glom", _("Glom options"), _("Command-line options for glom")),
m_arg_version(false),
- m_arg_debug_sql(false)
+ m_arg_debug_sql(false),
+ m_arg_debug_date_check(false)
{
Glib::OptionEntry entry;
entry.set_long_name("file");
@@ -98,9 +100,14 @@ OptionGroup::OptionGroup()
add_entry(entry_version, m_arg_version);
Glib::OptionEntry entry_debug_sql;
- entry_version.set_long_name("debug_sql");
- entry_version.set_description(_("Show the generated SQL queries on stdout, for debugging."));
- add_entry(entry_version, m_arg_debug_sql);
+ entry_debug_sql.set_long_name("debug_sql");
+ entry_debug_sql.set_description(_("Show the generated SQL queries on stdout, for debugging."));
+ add_entry(entry_debug_sql, m_arg_debug_sql);
+
+ Glib::OptionEntry entry_debug_date_check;
+ entry_debug_date_check.set_long_name("debug-date-check");
+ entry_debug_date_check.set_description(_("Show how Glom outputs a date in this locale, then stop."));
+ add_entry(entry_debug_date_check, m_arg_debug_date_check);
}
#ifdef GLOM_ENABLE_POSTGRESQL
@@ -443,12 +450,16 @@ main(int argc, char* argv[])
// Some more sanity checking:
// These print errors to the stdout if they fail.
// In future we might refuse to start if they fail.
- const bool test1 = Glom::Conversions::sanity_check_date_text_representation_uses_4_digit_years();
+ const bool test1 =
+ Glom::Conversions::sanity_check_date_text_representation_uses_4_digit_years(group.m_arg_debug_date_check);
const bool test2 = Glom::Conversions::sanity_check_date_parsing();
if(!test1 || !test2)
{
std::cerr << "Glom: ERROR: Date parsing sanity checks failed. Glom will not display dates correctly or interperet entered dates correctly. This needs attention from a translator. Please file a bug. See http://www.glom.org." << std::endl;
}
+
+ if(group.m_arg_debug_date_check)
+ return 0; //This command-line option is documented as stopping afterwards.
#ifdef GLIBMM_EXCEPTIONS_ENABLED
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]