diff options
author | Richard Maudsley <richard.maudsley@isode.com> | 2014-02-20 16:08:28 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2014-02-22 16:05:34 (GMT) |
commit | be45135a1b1051eab02003fe54ee7e87f5f1558e (patch) | |
tree | 773e8f4aa2eb16a48d55d94d294e18e4679a5661 | |
parent | cef2e5062022907dcf70ca23fbd345fdf545dbb9 (diff) | |
download | swift-be45135a1b1051eab02003fe54ee7e87f5f1558e.zip swift-be45135a1b1051eab02003fe54ee7e87f5f1558e.tar.bz2 |
Added timestamps to debug log.
Change-Id: I2024ebf4d97be8683cf563d9c151f97319bba880
-rw-r--r-- | Swift/QtUI/QtXMLConsoleWidget.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Swift/QtUI/QtXMLConsoleWidget.cpp b/Swift/QtUI/QtXMLConsoleWidget.cpp index 284f3c3..609c6a2 100644 --- a/Swift/QtUI/QtXMLConsoleWidget.cpp +++ b/Swift/QtUI/QtXMLConsoleWidget.cpp @@ -6,6 +6,8 @@ #include "QtXMLConsoleWidget.h" +#include <Swiften/Base/format.h> + #include <QCloseEvent> #include <QTextEdit> #include <QVBoxLayout> @@ -75,11 +77,15 @@ void QtXMLConsoleWidget::closeEvent(QCloseEvent* event) { } void QtXMLConsoleWidget::handleDataRead(const SafeByteArray& data) { - appendTextIfEnabled(std::string(tr("<!-- IN -->").toUtf8()) + "\n" + safeByteArrayToString(data) + "\n", QColor(33,98,33)); + boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); + std::string tag = str(format(std::string(QT_TRANSLATE_NOOP("", "<!-- IN %1% -->"))) % std::string(boost::posix_time::to_iso_extended_string(now))); + appendTextIfEnabled(tag + "\n" + safeByteArrayToString(data) + "\n", QColor(33,98,33)); } void QtXMLConsoleWidget::handleDataWritten(const SafeByteArray& data) { - appendTextIfEnabled(std::string(tr("<!-- OUT -->").toUtf8()) + "\n" + safeByteArrayToString(data) + "\n", QColor(155,1,0)); + boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); + std::string tag = str(format(std::string(QT_TRANSLATE_NOOP("", "<!-- OUT %1% -->"))) % std::string(boost::posix_time::to_iso_extended_string(now))); + appendTextIfEnabled(tag + "\n" + safeByteArrayToString(data) + "\n", QColor(155,1,0)); } void QtXMLConsoleWidget::appendTextIfEnabled(const std::string& data, const QColor& color) { |