[glom/glom-1-10] Reduce debug output.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Subject: [glom/glom-1-10] Reduce debug output.
- Date: Mon, 29 Jun 2009 12:30:06 +0000 (UTC)
commit 126598eb0b8089885ea48fa764a6e6544c81fa04
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Jun 29 14:29:59 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 | 35 +++++++++++++++++------
glom/libglom/data_structure/glomconversions.cc | 6 +++-
glom/libglom/data_structure/glomconversions.h | 2 +-
glom/main.cc | 19 ++++++++++---
6 files changed, 62 insertions(+), 17 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b192166..8454a65 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.
+
1.10.1:
2009-05-25 Armin Burgmeier <armin openismus com>
diff --git a/glom/dialog_existing_or_new.cc b/glom/dialog_existing_or_new.cc
index 7df58e7..5184194 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 2c530f4..55533c9 100644
--- a/glom/libglom/connectionpool.cc
+++ b/glom/libglom/connectionpool.cc
@@ -291,14 +291,20 @@ sharedptr<SharedConnection> ConnectionPool::get_and_connect(std::auto_ptr<Except
sharedptr<SharedConnection> result(0);
ConnectionPool* connection_pool = ConnectionPool::get_instance();
- if(connection_pool)
+ if(!connection_pool)
+ return result;
+
+ 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 error?, though that would be tedious.
+ }
+
#ifdef GLIBMM_EXCEPTIONS_ENABLED
- result = connection_pool->connect();
+ result = connection_pool->connect();
#else
- result = connection_pool->connect(error);
+ result = connection_pool->connect(error);
#endif // GLIBMM_EXCEPTIONS_ENABLED
- }
return result;
}
@@ -373,12 +379,23 @@ 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: Calling update_meta_store_table_names() ..." << std::endl;
- m_refGdaConnection->update_meta_store_table_names();
- std::cout << "DEBUG: ... update_meta_store_table_names() 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;
+ try
+ {
+ //update_meta_store_table_names() has been known to throw an exception.
+ //Glom is mostly unusable when it fails, but that's still better than a crash.
+ m_refGdaConnection->update_meta_store_table_names(m_backend->get_public_schema_name());
+ }
+ catch(const Glib::Error& ex)
+ {
+ std::cerr << "update_meta_store_table_names() failed: " << ex.what() << 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 4e5a45b..95c4744 100644
--- a/glom/libglom/data_structure/glomconversions.cc
+++ b/glom/libglom/data_structure/glomconversions.cc
@@ -157,7 +157,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;
@@ -170,7 +170,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 7402811..ff0f3cc 100644
--- a/glom/libglom/data_structure/glomconversions.h
+++ b/glom/libglom/data_structure/glomconversions.h
@@ -70,7 +70,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 0f87072..80b1756 100644
--- a/glom/main.cc
+++ b/glom/main.cc
@@ -73,12 +73,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_date_check(false)
{
Glib::OptionEntry entry;
entry.set_long_name("file");
@@ -93,9 +95,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);
}
} //namespace Glom
@@ -281,12 +288,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]