Index: trunk/Cosy/candrv/sdolist.cc
===================================================================
--- trunk/Cosy/candrv/sdolist.cc	(revision 14585)
+++ trunk/Cosy/candrv/sdolist.cc	(revision 14586)
@@ -1,5 +1,9 @@
 #include "sdolist.h"
 
-#include <iostream>
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MTime.h"
+
 
 ClassImp(PendingSDO);
@@ -8,6 +12,19 @@
 using namespace std;
 
+#undef DEBUG
+
+#ifdef DEBUG
+#include <fstream>
+static ofstream fout;
+#endif
+
 PendingSDOList::PendingSDOList()
 {
+#ifdef DEBUG
+    fout.open("sdolist.txt", ios::app);
+    fout.rdbuf()->pubsetbuf(0,0);
+    fout << hex;
+#endif
+
     fFirst = new PendingSDO;
     fLast  = fFirst;
@@ -18,4 +35,8 @@
     DelAll();
     delete fFirst;
+
+#ifdef DEBUG
+    fout.close();
+#endif
 }
 
@@ -23,5 +44,9 @@
 {
     if (fMux.Lock()==13)
-        cout << "PendingSDOList::DelAll - mutex is already locked by this thread" << endl;
+        gLog << err << MTime(-1) << " -  PendingSDOList::DelAll - mutex is already locked by this thread" << endl;
+
+#ifdef DEBUG
+    fout << MTime(-1) << " - DelAll" << endl;
+#endif
 
     PendingSDO *prev = fFirst;
@@ -39,5 +64,5 @@
 
     if (fMux.UnLock()==13)
-        cout << "PendingSDOList::DelAll - tried to unlock mutex locked by other thread." << endl;
+        gLog << err << MTime(-1) << " -  PendingSDOList::DelAll - tried to unlock mutex locked by other thread." << endl;
 }
 
@@ -47,11 +72,16 @@
 
     if (fMux.Lock()==13)
-        cout << "PendingSDOList::Add - mutex is already locked by this thread" << endl;
+        gLog << err << MTime(-1) << " -  PendingSDOList::Add - mutex is already locked by this thread" << endl;
+
+#ifdef DEBUG
+    fout << MTime(-1) << " - Add " << idx << "/" << subidx << " @ " << node << endl;
+#endif
+
     while ((sdo=sdo->Next))
         if (sdo->Node==node && sdo->Idx==idx && sdo->Subidx==subidx)
         {
-            cout << "Warning: SDO Node #" << dec << (int)node << ", 0x";
-            cout << hex << idx << "/" << (int)subidx;
-            cout << " still pending." << endl;
+            gLog << warn << MTime(-1) << " - SDO Node #" << dec << (int)node << ", 0x";
+            gLog << hex << idx << "/" << (int)subidx;
+            gLog << " still pending." << endl;
             break;
         }
@@ -60,5 +90,5 @@
     fLast = fLast->Next;
     if (fMux.UnLock()==13)
-        cout << "PendingSDOList::Add - tried to unlock mutex locked by other thread." << endl;
+        gLog << err << MTime(-1) << " - PendingSDOList::Add - tried to unlock mutex locked by other thread." << endl;
 }
 
@@ -69,5 +99,10 @@
 
     if (fMux.Lock()==13)
-        cout << "PendingSDOList::Del - mutex is already locked by this thread" << endl;
+        gLog << err << MTime(-1) << " -  PendingSDOList::Del - mutex is already locked by this thread" << endl;
+
+#ifdef DEBUG
+    fout << MTime(-1) << " - Del " << idx << "/" << subidx << " @ " << node << endl;
+#endif
+
     while ((sdo=prev->Next))
     {
@@ -88,5 +123,5 @@
     }
     if (fMux.UnLock()==13)
-        cout << "PendingSDOList::Del - tried to unlock mutex locked by other thread." << endl;
+        gLog << err <<  MTime(-1) << " - PendingSDOList::Del - tried to unlock mutex locked by other thread." << endl;
 }
 
@@ -102,5 +137,5 @@
 
     if (fMux.Lock()==13)
-        cout << "PendingSDOList::IsPending(byte) - mutex is already locked by this thread" << endl;
+        gLog << err << MTime(-1) << " - PendingSDOList::IsPending(byte) - mutex is already locked by this thread" << endl;
     while ((sdo=sdo->Next))
         if (sdo->Node==node)
@@ -110,5 +145,5 @@
         }
     if (fMux.UnLock()==13)
-        cout << "PendingSDOList::IsPending(byte) - tried to unlock mutex locked by other thread." << endl;
+        gLog << err << MTime(-1) << " - PendingSDOList::IsPending(byte) - tried to unlock mutex locked by other thread." << endl;
 
     return rc;
@@ -121,5 +156,5 @@
 
     if (fMux.Lock()==13)
-        cout << "PendingSDOList::IsPending - mutex is already locked by this thread" << endl;
+        gLog << err <<  MTime(-1) << " - PendingSDOList::IsPending - mutex is already locked by this thread" << endl;
     while ((sdo=sdo->Next))
         if (sdo->Node==node && sdo->Idx==idx && sdo->Subidx==subidx)
@@ -129,5 +164,5 @@
         }
     if (fMux.UnLock()==13)
-        cout << "PendingSDOList::IsPending - tried to unlock mutex locked by other thread." << endl;
+        gLog << err <<  MTime(-1) << " - PendingSDOList::IsPending - tried to unlock mutex locked by other thread." << endl;
 
     return rc;
