Index: common/Common.cpp
===================================================================
--- common/Common.cpp	(revision b35b2b25df5c3c0e8e63e6f9c60d145b6996c085)
+++ common/Common.cpp	(revision d05086b35357b52ba3843d9c5195f9bd226aa3e7)
@@ -1,5 +1,5 @@
 #include "Common.h"
 
-#include <iostream>
+#include <sstream>
 #include <cmath>
 
@@ -7,18 +7,8 @@
    #include <Windows.h>
 #elif defined LINUX
-   #include <time.h>
+   #include <ctime>
 #endif
 
 using namespace std;
-
-/*
-FLOAT_POSITION POSITION::toFloat() {
-   FLOAT_POSITION floatPosition;
-   floatPosition.x = x;
-   floatPosition.y = y;
-
-   return floatPosition;
-}
-*/
 
 void set_nonblock(int sock)
@@ -51,4 +41,14 @@
 }
 
+string getCurrentDateTimeString() {
+   time_t millis = time(NULL);
+   struct tm *time = localtime(&millis);
+
+   ostringstream timeString;
+   timeString << time->tm_hour << ":" << time->tm_min << ":"<< time->tm_sec << " " << (time->tm_mon+1) << "/" << time->tm_mday << "/" << (time->tm_year+1900);
+
+   return timeString.str();
+}
+
 float posDistance(FLOAT_POSITION pos1, FLOAT_POSITION pos2) {
    float xDiff = pos2.x - pos1.x;
Index: common/Common.h
===================================================================
--- common/Common.h	(revision b35b2b25df5c3c0e8e63e6f9c60d145b6996c085)
+++ common/Common.h	(revision d05086b35357b52ba3843d9c5195f9bd226aa3e7)
@@ -12,4 +12,8 @@
 #endif
 
+#include <string>
+
+using namespace std;
+
 typedef struct
 {
@@ -22,5 +26,4 @@
    int x;
    int y;
-   //FLOAT_POSITION toFloat();
    FLOAT_POSITION toFloat() {
       FLOAT_POSITION floatPosition;
@@ -34,4 +37,5 @@
 void set_nonblock(int sock);
 unsigned long long getCurrentMillis();
+string getCurrentDateTimeString();
 float posDistance(FLOAT_POSITION pos1, FLOAT_POSITION pos2);
 
Index: common/MessageProcessor.cpp
===================================================================
--- common/MessageProcessor.cpp	(revision b35b2b25df5c3c0e8e63e6f9c60d145b6996c085)
+++ common/MessageProcessor.cpp	(revision d05086b35357b52ba3843d9c5195f9bd226aa3e7)
@@ -2,4 +2,5 @@
 
 #include <iostream>
+#include <fstream>
 
 #include "Common.h"
@@ -12,10 +13,12 @@
 }
 
-int MessageProcessor::sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest) {
+int MessageProcessor::sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest, ofstream* outputLog) {
    cout << "Sending message of type " << msg->type << endl;
 
    msg->id = ++lastUsedId;
    MessageContainer message(*msg, *dest);
-   sentMessages[msg->id][dest->sin_addr.s_addr] = message;
+
+   if (outputLog)
+      (*outputLog) << "Sending message (id " << msg->id << ") of type " << MessageContainer::getMsgTypeString(msg->type) << endl;
 
    sentMessages[msg->id][dest->sin_addr.s_addr] = message;
@@ -26,5 +29,5 @@
 }
 
-int MessageProcessor::receiveMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *source) {
+int MessageProcessor::receiveMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *source, ofstream* outputLog) {
    socklen_t socklen = sizeof(struct sockaddr_in);
 
@@ -40,4 +43,6 @@
          sentMessages[msg->id][source->sin_addr.s_addr].setAcked(true);
          sentMessages[msg->id][source->sin_addr.s_addr].setTimeAcked(getCurrentMillis());
+         if (outputLog)
+            (*outputLog) << "Received ack for message id " << msg->id << endl;
       }
 
@@ -49,6 +54,9 @@
          isDuplicate = true;
          cout << "Got duplicate of type " << msg->type << endl;
-      }else
+      }else {
          cout << "Got message of type " << msg->type << endl;
+         if (outputLog)
+            (*outputLog) << "Received message (id " << msg->id << ") of type " << MessageContainer::getMsgTypeString(msg->type) << endl;
+      }
 
       ackedMessages[msg->id] = MessageContainer(*msg, *source);
@@ -69,5 +77,5 @@
 }
 
-void MessageProcessor::resendUnackedMessages(int sock) {
+void MessageProcessor::resendUnackedMessages(int sock, ofstream* outputLog) {
    map<unsigned int, map<unsigned long, MessageContainer> >::iterator it;
    map<unsigned long, MessageContainer>::iterator it2;
@@ -84,5 +92,5 @@
 }
 
-void MessageProcessor::cleanAckedMessages() {
+void MessageProcessor::cleanAckedMessages(ofstream* outputLog) {
    map<unsigned int, map<unsigned long, MessageContainer> >::iterator it = sentMessages.begin();
    map<unsigned long, MessageContainer>::iterator it2;
@@ -92,7 +100,9 @@
       while (it2 != it->second.end()) {
          if (it2->second.getAcked()) {
-            if ((getCurrentMillis() - it2->second.getTimeAcked()) > 1000)
+            if ((getCurrentMillis() - it2->second.getTimeAcked()) > 1000) {
+               if (outputLog)
+                  (*outputLog) << "Removing id " << it2->second.getMessage()->id << " from the acked record" << endl;
                it->second.erase(it2++);
-            else
+            }else
                it2++;
          }else
Index: common/MessageProcessor.h
===================================================================
--- common/MessageProcessor.h	(revision b35b2b25df5c3c0e8e63e6f9c60d145b6996c085)
+++ common/MessageProcessor.h	(revision d05086b35357b52ba3843d9c5195f9bd226aa3e7)
@@ -24,8 +24,8 @@
    ~MessageProcessor();
 
-   int sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest);
-   int receiveMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest);
-   void resendUnackedMessages(int sock);
-   void cleanAckedMessages();
+   int sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest, ofstream* outputLog = NULL);
+   int receiveMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest, ofstream* outputLog = NULL);
+   void resendUnackedMessages(int sock, ofstream* outputLog = NULL);
+   void cleanAckedMessages(ofstream* outputLog = NULL);
 
    map<unsigned int, map<unsigned long, MessageContainer> >& getSentMessages();
