From 40f668265e279f94c1a30d908aad431063a154da Mon Sep 17 00:00:00 2001 From: Jamie Thompson Date: Thu, 25 Aug 2011 02:58:09 +0100 Subject: [PATCH] Minor debugging tidy ups. Some tracing disabled until either a configurable use is put in, or it gets properly removed. --- DBBackends/RtcomEventLogger.cpp | 25 ++++++++++++------------- EventProcessors/Hasher.cpp | 2 +- main.cpp | 9 +++++++++ 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/DBBackends/RtcomEventLogger.cpp b/DBBackends/RtcomEventLogger.cpp index 20daa23..dbea940 100644 --- a/DBBackends/RtcomEventLogger.cpp +++ b/DBBackends/RtcomEventLogger.cpp @@ -399,7 +399,7 @@ void RtcomEventLogger::Reindex() if(min == 0) min = one; - qDebug() << "( " << one << ", " << two << " )"; + //qDebug() << "( " << one << ", " << two << " )"; mapping.insert(one, two); } } @@ -437,23 +437,23 @@ void RtcomEventLogger::Reindex() int val(min); sequence.append(0); sequence.append(val); - qDebug().nospace() << "val1: " << val << ", "; + //qDebug().nospace() << "val1: " << val << ", "; while((val = mapping[val]) && val != min) { sequence.append(val); - qDebug().nospace() << val << ", "; + //qDebug().nospace() << val << ", "; } sequence.append(0); - qDebug().nospace() << "seq: "; + //qDebug().nospace() << "seq: "; QList > updates; int last(sequence.first()); foreach(int seq, sequence) { if(seq != last) { - qDebug().nospace() << seq << ", " << last << ", "; + //qDebug().nospace() << seq << ", " << last << ", "; updates.append(QPair(seq, last)); } @@ -488,7 +488,7 @@ void RtcomEventLogger::Reindex() } } - qDebug() << query; + //qDebug() << query; QSqlQuery * UpdateQuery(new QSqlQuery( db )); if(UpdateQuery != NULL) @@ -502,9 +502,7 @@ void RtcomEventLogger::Reindex() { for( QStringList::const_iterator currentStatement(statements.constBegin()); currentStatement != statements.constEnd(); ++currentStatement) { - if ( UpdateQuery->exec( *currentStatement )) - qDebug() << "Query OK, " << UpdateQuery->numRowsAffected() << " rows affected."; - else + if (!UpdateQuery->exec(*currentStatement)) { qDebug() << "Query Failed: " << *currentStatement; throw std::exception(); @@ -632,10 +630,10 @@ QDebug operator<<(QDebug dbg, RTComElEvent &event) dbg.nospace() << "\tservice:\t" << event.fld_service << "\n"; dbg.nospace() << "\tevt_typ_id:\t" << event.fld_event_type_id << "\n"; dbg.nospace() << "\tevt_typ:\t" << event.fld_event_type << "\n"; - dbg.nospace() << "\tstore-time:\t" << QDateTime::fromTime_t(event.fld_storage_time) << "\n"; - dbg.nospace() << "\tstart-time:\t" << QDateTime::fromTime_t(event.fld_start_time) << "\n"; - dbg.nospace() << "\tend-time:\t\t" << QDateTime::fromTime_t(event.fld_end_time) << "\n"; - dbg.nospace() << "\tis-read:\t\t" << (event.fld_is_read ? "true" : "false") << "\n"; + dbg.nospace() << "\tstore-time:\t" << QDateTime::fromTime_t(event.fld_storage_time).toUTC() << "\n"; + dbg.nospace() << "\tstart-time:\t" << QDateTime::fromTime_t(event.fld_start_time).toUTC() << "\n"; + dbg.nospace() << "\tend-time:\t" << QDateTime::fromTime_t(event.fld_end_time).toUTC() << "\n"; + dbg.nospace() << "\tis-read:\t" << (event.fld_is_read ? "true" : "false") << "\n"; dbg.nospace() << "\tdirection:\t" << (event.fld_outgoing ? "Outgoing" : "Incoming") << "\n"; dbg.nospace() << "\tflags:\t\t" << "0x" << QString::number(event.fld_flags, 16) << "\n"; dbg.nospace() << "\tbytes sent:\t" << event.fld_bytes_sent << "\n"; @@ -644,6 +642,7 @@ QDebug operator<<(QDebug dbg, RTComElEvent &event) dbg.nospace() << "\tlocal-name:\t" << event.fld_local_name << "\n"; dbg.nospace() << "\tremote-uid:\t" << event.fld_remote_uid << "\n"; dbg.nospace() << "\tremote-name:\t" << event.fld_remote_name << "\n"; + dbg.nospace() << "\tremote-ebid:\t" << event.fld_remote_ebook_uid << "\n"; dbg.nospace() << "\tchannel:\t\t" << event.fld_channel << "\n"; dbg.nospace() << "\tfree-text:\t" << event.fld_free_text << "\n"; dbg.nospace() << "\tgroup-uid:\t" << event.fld_group_uid << "\n"; diff --git a/EventProcessors/Hasher.cpp b/EventProcessors/Hasher.cpp index 19ad9f7..60a4bc9 100644 --- a/EventProcessors/Hasher.cpp +++ b/EventProcessors/Hasher.cpp @@ -33,7 +33,7 @@ void Hasher::Process(EventTypes::iEvent &event) { uint hash(event.HashCode()); m_Hashes.insert(hash); - qDebug() << "DB Event hash: " << hash << " @ " << event.Timestamp(); + qDebug() << "DB Event hash: " << hash << " @ " << event.Timestamp().toUTC(); } void Hasher::EmitEventProcessed(int eventsProcessed, int totalEvents) diff --git a/main.cpp b/main.cpp index c81212e..a19b8dc 100644 --- a/main.cpp +++ b/main.cpp @@ -22,12 +22,21 @@ #include "ui_dialog.h" +#include #include #include #include +#include +void g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data) +{ + qDebug() << "GLIB: " << log_domain << "" << log_level << "" << message << "\n"; +} + int main(int argc, char *argv[]) { + g_log_set_default_handler(g_log_default_handler, NULL); + QApplication app(argc, argv); Settings settings; -- 1.7.9.5