From be45135a1b1051eab02003fe54ee7e87f5f1558e Mon Sep 17 00:00:00 2001
From: Richard Maudsley <richard.maudsley@isode.com>
Date: Thu, 20 Feb 2014 16:08:28 +0000
Subject: Added timestamps to debug log.

Change-Id: I2024ebf4d97be8683cf563d9c151f97319bba880

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) {
-- 
cgit v0.10.2-6-g49f6