Index: /trunk/MagicSoft/Cosy/Changelog
===================================================================
--- /trunk/MagicSoft/Cosy/Changelog	(revision 8834)
+++ /trunk/MagicSoft/Cosy/Changelog	(revision 8835)
@@ -80,4 +80,9 @@
      - changed to new threading classes
      - thread doesn't run detached anymore
+
+   * candrv/nodedrv.[h,cc], devdrv/macs.[h,cc], devdrv/shaftencoder.[h,cc]:
+     - changed from lout to gLog
+     - added maipulators 
+     - removed MLog from the constructor
 
 
Index: /trunk/MagicSoft/Cosy/candrv/network.cc
===================================================================
--- /trunk/MagicSoft/Cosy/candrv/network.cc	(revision 8834)
+++ /trunk/MagicSoft/Cosy/candrv/network.cc	(revision 8835)
@@ -32,6 +32,6 @@
 #include "network.h"
 
-#include <iostream> // cout
-#include <iomanip>  // setw, setfill
+#include "MLog.h"
+#include "MLogManip.h"
 
 ClassImp(Network);
@@ -46,10 +46,10 @@
 void Network::Start()
 {
-    gLog << "- Starting network." << endl;
+    gLog << inf << "- Starting network." << endl;
 
     CanOpen::Start();
     InitNodes();
 
-    gLog << "- Network started." << endl;
+    gLog << inf << "- Network started." << endl;
 }
 
@@ -60,10 +60,10 @@
 void Network::Stop()
 {
-    gLog << "- Stopping network." << endl;
+    gLog << inf << "- Stopping network." << endl;
 
     StopNodes();
     CanOpen::Stop();
 
-    gLog << "- Network stopped." << endl;
+    gLog << inf << "- Network stopped." << endl;
 }
 
@@ -77,5 +77,5 @@
     memset(fNodeInitialized, 0, 32*sizeof(*fNodeInitialized));
 
-    gLog << "- Network initialized." << endl;
+    gLog << inf << "- Network initialized." << endl;
 }
 
@@ -115,8 +115,8 @@
         }
 
-    cout << dec << setfill('0');
-    cout << "Network::HandleSDO: Node=" << (int)node  << " Cmd=0x" << hex << (int)cmd << ": ";
-    cout << "Sdo=" << idx  << "/" << (int)subidx << ": 0x" << setw(8) << data;
-    cout << endl;
+    gLog << warn << dec << setfill('0');
+    gLog << "Network::HandleSDO: Node=" << (int)node  << " Cmd=0x" << hex << (int)cmd << ": ";
+    gLog << "Sdo=" << idx  << "/" << (int)subidx << ": 0x" << setw(8) << data;
+    gLog << endl;
 }
 
@@ -129,8 +129,8 @@
     if (!fNodes[node])
     {
-        cout << "Network::HandlePDO1: Node #" << dec << (int)node << " not found - PDO1: " << hex;
+        gLog << err << "ERROR - Network::HandlePDO1: Node #" << dec << (int)node << " not found - PDO1: " << hex;
         for (int i=0; i<8; i++)
-            cout << " 0x" << (int)data[i];
-        cout << endl;
+            gLog << " 0x" << (int)data[i];
+        gLog << endl;
         return;
     }
@@ -147,8 +147,8 @@
     if (!fNodes[node])
     {
-        cout << "Network::HandlePDO2: Node #" << dec << (int)node << " not found - PDO2: " << hex;
+        gLog << err << "ERROR - Network::HandlePDO2: Node #" << dec << (int)node << " not found - PDO2: " << hex;
         for (int i=0; i<8; i++)
-            cout << " 0x" << (int)data[i];
-        cout << endl;
+            gLog << " 0x" << (int)data[i];
+        gLog << endl;
         return;
     }
@@ -165,8 +165,8 @@
     if (!fNodes[node])
     {
-        cout << "Network::HandlePDO3: Node #" << dec << (int)node << " not found - PDO3: " << hex;
+        gLog << err << "ERROR - Network::HandlePDO3: Node #" << dec << (int)node << " not found - PDO3: " << hex;
         for (int i=0; i<8; i++)
-            cout << " 0x" << (int)data[i];
-        cout << endl;
+            gLog << " 0x" << (int)data[i];
+        gLog << endl;
         return;
     }
@@ -183,8 +183,8 @@
     if (!fNodes[node])
     {
-        cout << "Network::HandlePDO4: Node #" << dec << (int)node << " not found - PDO4: " << hex;
+        gLog << err << "ERROR - Network::HandlePDO4: Node #" << dec << (int)node << " not found - PDO4: " << hex;
         for (int i=0; i<8; i++)
-            cout << " 0x" << (int)data[i];
-        cout << endl;
+            gLog << " 0x" << (int)data[i];
+        gLog << endl;
         return;
     }
@@ -202,5 +202,5 @@
     if (!fNodes[node])
     {
-        cout << "Network::HandleNodeguard: Node #" << dec << (int)node << " not found: Nodeguard." << endl;
+        gLog << err << "ERROR - Network::HandleNodeguard: Node #" << dec << (int)node << " not found: Nodeguard." << endl;
         return;
     }
@@ -218,5 +218,5 @@
     if (!fNodes[node])
     {
-        cout << "Network::HandleEmergency: Node #" << dec << (int)node << " not found: Emergency." << endl;
+        gLog << err << "ERROR - Network::HandleEmergency: Node #" << dec << (int)node << " not found: Emergency." << endl;
         return;
     }
@@ -236,5 +236,5 @@
     if (nodeid>31)
     {
-        cout << "SetNode - Error: Only node Numbers < 32 are allowed"<< endl;
+        gLog << err << "ERROR - Network::SetNode: Only node Numbers < 32 are allowed"<< endl;
         return;
     }
@@ -252,12 +252,12 @@
         if (fNodes[i])
         {
-            gLog << "- Setting up Node #" << dec << i << " (";
+            gLog << inf2 << "- Setting up Node #" << dec << i << " (";
             gLog << fNodes[i]->GetNodeName() << ")" << endl;
             if (fNodes[i]->InitDevice(this))
                 fNodeInitialized[i] = TRUE;
             else
-                gLog << "- " << fNodes[i]->GetNodeName() << ": InitDevice failed." << endl;
+                gLog << err << "- " << fNodes[i]->GetNodeName() << ": InitDevice failed." << endl;
         }
-    gLog << "- All Nodes setup." << endl;
+    gLog << inf << "- All Nodes setup." << endl;
 }
 
@@ -271,9 +271,9 @@
         if (fNodes[i] && fNodeInitialized[i])
         {
-            gLog << "- Stopping Node #" << dec << i;
+            gLog << inf2 << "- Stopping Node #" << dec << i;
             gLog << " (" << fNodes[i]->GetNodeName() << ")" << endl;
             fNodes[i]->StopDevice();
         }
-    gLog << "- All Nodes stopped." << endl;
+    gLog << inf << "- All Nodes stopped." << endl;
 }
 
@@ -292,5 +292,5 @@
             continue;
 
-        gLog << "- Node #" << dec << i << " '" << fNodes[i]->GetNodeName() << "' ";
+        gLog << err << "- Node #" << dec << i << " '" << fNodes[i]->GetNodeName() << "' ";
 
         if (fNodes[i]->GetError() <= 0)
@@ -362,6 +362,6 @@
                 }
 
-    if (rc)
-        gLog << "- All Zombies rebooted." << endl;
+//    if (rc)
+//        gLog << inf << "- All Zombies rebooted." << endl;
 
     return rc;
Index: /trunk/MagicSoft/Cosy/candrv/network.h
===================================================================
--- /trunk/MagicSoft/Cosy/candrv/network.h	(revision 8834)
+++ /trunk/MagicSoft/Cosy/candrv/network.h	(revision 8835)
@@ -42,5 +42,5 @@
     bool HasZombie() const;
 
-    bool RebootZombies();
+    bool RebootZombies(Int_t max=33);
     void CheckConnections();
 
Index: /trunk/MagicSoft/Cosy/candrv/nodedrv.cc
===================================================================
--- /trunk/MagicSoft/Cosy/candrv/nodedrv.cc	(revision 8834)
+++ /trunk/MagicSoft/Cosy/candrv/nodedrv.cc	(revision 8835)
@@ -52,4 +52,5 @@
 #include "MTime.h"
 #include "network.h"
+
 #include "MLogManip.h"
 
@@ -65,9 +66,9 @@
 // and the node name. The name is a name for debug output.
 //
-NodeDrv::NodeDrv(BYTE_t nodeid, const char *name, MLog &out) : Log(out), fNetwork(NULL), fId(32), fError(0), fIsZombie(kTRUE), fGuard(NULL)
+NodeDrv::NodeDrv(BYTE_t nodeid, const char *name) : fNetwork(NULL), fId(32), fError(0), fIsZombie(kTRUE), fGuard(NULL)
 {
     if (nodeid>0x1f)
     {
-        cout << "SetNode - Error: Only node Numbers < 32 are allowed"<< endl;
+        gLog << err << "ERROR - NodeDrv::NodeDrv: Only node Numbers < 32 are allowed"<< endl;
         return;
     }
@@ -83,5 +84,5 @@
     }
 
-    lout << "- Node #" << (int)nodeid << " (" << name << ") initialized." << endl;
+    gLog << inf2 << "- Node #" << (int)nodeid << " (" << name << ") initialized." << endl;
 
 }
@@ -149,15 +150,15 @@
 void NodeDrv::HandleSDOOK(WORD_t idx, BYTE_t subidx, LWORD_t data, const timeval_t &tv)
 {
-    const Bool_t gui = lout.IsOutputDeviceEnabled(MLog::eGui);
+    const Bool_t gui = gLog.IsOutputDeviceEnabled(MLog::eGui);
 
     if (gui)
-        lout << ddev(MLog::eGui);
-
-    lout << hex << setfill('0');
-    lout << "Node #" << dec << (int)fId << ": Sdo=" << hex << idx  << "/" << (int)subidx << " set.";
-    lout << endl;
+        gLog << ddev(MLog::eGui);
+
+    gLog << warn << setfill('0') << "WARNING - Nodedrv::HandleSDOOK: ";
+    gLog << "Node #" << dec << (int)fId << ": Sdo=" << hex << idx  << "/" << (int)subidx << " set.";
+    gLog << endl;
 
     if (gui)
-        lout << edev(MLog::eGui);
+        gLog << edev(MLog::eGui);
 }
 
@@ -168,7 +169,7 @@
 void NodeDrv::HandleSDOError(LWORD_t data)
 {
-    lout << "Nodedrv: SDO Error: Entry not found in dictionary (data=0x";
-    lout << hex << setfill('0') << setw(4) << data << ")";
-    lout << endl;
+    gLog << warn << "WARNING - Nodedrv::HandleSDOError: Entry not found in dictionary (data=0x";
+    gLog << hex << setfill('0') << setw(4) << data << ")";
+    gLog << endl;
 }
 
@@ -179,6 +180,6 @@
 void NodeDrv::HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, const timeval_t &tv)
 {
-    cout << "SdoRx: Idx=0x"<< hex << idx << "/" << (int)subidx;
-    cout << ", val=0x" << val << endl;
+    gLog << warn << "WARNING - Nodedrv::HandleSDO: Idx=0x"<< hex << idx << "/" << (int)subidx;
+    gLog << ", val=0x" << val << endl;
 }
 
@@ -426,5 +427,5 @@
         return true;
 
-    lout << " + " << GetNodeName() << ": NodeDrv::WaitForSdo: 0x" << hex << idx << "/" << dec << (int)subidx << " --> ZOMBIE! " << MTime(-1) << endl;
+    gLog << inf2 << " + " << GetNodeName() << ": NodeDrv::WaitForSdo: 0x" << hex << idx << "/" << dec << (int)subidx << " --> ZOMBIE! " << MTime(-1) << endl;
     if (zombie)
         SetZombie();
@@ -555,6 +556,6 @@
     fGuard->RunThread();
 
-    lout << "- " << GetNodeName() << ": Guarding (" << dec;
-    lout << fLifeTimeFactor << "*" << fGuardTime << "ms) started." << endl;
+    gLog << inf << "- " << GetNodeName() << ": Guarding (" << dec;
+    gLog << fLifeTimeFactor << "*" << fGuardTime << "ms) started." << endl;
 }
 
@@ -563,5 +564,5 @@
     if (fGuard)
     {
-        lout << "- " << GetNodeName() << ": ERROR - Guarding already started." << endl;
+        gLog << err << "- " << GetNodeName() << ": ERROR - Guarding already started." << endl;
         return;
     }
@@ -581,5 +582,5 @@
     fGuard=NULL;
 
-    lout << "- " << GetNodeName() << ": Guarding stopped." << endl;
+    gLog << inf << "- " << GetNodeName() << ": Guarding stopped." << endl;
 }
 
@@ -601,4 +602,4 @@
         StopGuarding();
     else
-        lout << " - " << GetNodeName() << ": Zombie set due to timeout." << endl;
-}
+        gLog << warn << " - " << GetNodeName() << ": Zombie set due to timeout." << endl;
+}
Index: /trunk/MagicSoft/Cosy/candrv/nodedrv.h
===================================================================
--- /trunk/MagicSoft/Cosy/candrv/nodedrv.h	(revision 8834)
+++ /trunk/MagicSoft/Cosy/candrv/nodedrv.h	(revision 8835)
@@ -4,8 +4,4 @@
 #ifndef ROOT_TString
 #include <TString.h>
-#endif
-
-#ifndef COSY_Log
-#include "log.h"
 #endif
 
@@ -25,5 +21,5 @@
 class NodeGuard;
 
-class NodeDrv : public Log
+class NodeDrv
 {
 private:
@@ -50,5 +46,5 @@
 
 public:
-    NodeDrv(BYTE_t nodeid, const char *name=NULL, MLog &out=gLog);
+    NodeDrv(BYTE_t nodeid, const char *name=NULL);
     virtual ~NodeDrv();
 
Index: /trunk/MagicSoft/Cosy/devdrv/macs.cc
===================================================================
--- /trunk/MagicSoft/Cosy/devdrv/macs.cc	(revision 8834)
+++ /trunk/MagicSoft/Cosy/devdrv/macs.cc	(revision 8835)
@@ -1,5 +1,4 @@
 #include "macs.h"
 
-#include <iostream>
 #include <sys/time.h>   // timeval->tv_sec
 
@@ -29,6 +28,6 @@
 */
 
-Macs::Macs(const BYTE_t nodeid, const char *name, MLog &out)
-    : NodeDrv(nodeid, name, out), fMacId(2*nodeid+1),
+Macs::Macs(const BYTE_t nodeid, const char *name)
+    : NodeDrv(nodeid, name), fMacId(2*nodeid+1),
     fPos(0), fPdoPos(0), fPosActive(0), fRpmActive(0),
     fStatusPdo3(0xff)
@@ -53,10 +52,10 @@
         if (subidx!=2)
             return;
-        lout << "- " << GetNodeName() << ": Error[0]=" << dec << val << endl;
+        gLog << inf2 << "- " << GetNodeName() << ": Error[0]=" << dec << val << endl;
         SetError(val);
         return;
 
     case 0x100a:
-        lout << "- " << GetNodeName() << ": Using Software Version V" << dec << (int)(val>>16) << "." << (int)(val&0xff) << endl;
+        gLog << inf2 << "- " << GetNodeName() << ": Using Software Version V" << dec << (int)(val>>16) << "." << (int)(val&0xff) << endl;
         fSoftVersion = val;
         return;
@@ -68,13 +67,13 @@
 
     case 0x100c:
-        lout << "- " << GetNodeName() << ": Guard time:" << dec << val << endl;
+        gLog << inf2 << "- " << GetNodeName() << ": Guard time:" << dec << val << endl;
         return;
 
     case 0x100d:
-        lout << "- " << GetNodeName() << ": Life time factor:" << dec << val << endl;
+        gLog << inf2 << "- " << GetNodeName() << ": Life time factor:" << dec << val << endl;
         return;
 
     case 0x2002:
-        cout << GetNodeName() << ": Current velocity: " << dec << val << endl;
+        gLog << inf2 << GetNodeName() << ": Current velocity: " << dec << val << endl;
         fVel = val;
         return;
@@ -123,15 +122,18 @@
 
     case 0x6002:
-        lout << "- " << GetNodeName() << ": Velocity resolution = " << dec << val << " ticks/min" << endl;
+        gLog << inf2 << "- " << GetNodeName() << ": Velocity resolution = " << dec << val << " ticks/min" << endl;
         fVelRes = val;
         return;
 
     case 0x6501:
-        lout << "- " << GetNodeName() << ": Encoder resolution = " << dec << val << " ticks/min" << endl;
+        gLog << inf2 << "- " << GetNodeName() << ": Encoder resolution = " << dec << val << " ticks/min" << endl;
         fRes = val;
         return;
     }
-    cout << "Macs: SDO, idx=0x"<< hex << idx << "/" << (int)subidx;
-    cout << ", val=0x"<<val<<endl;
+
+    NodeDrv::HandleSDO(idx, subidx, val, tv);
+
+//    cout << "Macs: SDO, idx=0x"<< hex << idx << "/" << (int)subidx;
+//    cout << ", val=0x"<<val<<endl;
 }
 
@@ -154,5 +156,5 @@
         case 1:
             //lout << ddev(MLog::eGui);
-            lout << "- " << GetNodeName() << ": State of node set." << endl;
+            gLog << inf2 << "- " << GetNodeName() << ": State of node set." << endl;
             //lout << edev(MLog::eGui);
             return;
@@ -165,5 +167,5 @@
         case 0:
             //lout << ddev(MLog::eGui);
-            lout << "- " << GetNodeName() << ": Guard time set." << endl;
+            gLog << inf2 << "- " << GetNodeName() << ": Guard time set." << endl;
             //lout << edev(MLog::eGui);
             return;
@@ -176,5 +178,5 @@
         case 0:
             //lout << ddev(MLog::eGui);
-            lout << "- " << GetNodeName() << ": Life time factor set." << endl;
+            gLog << inf2 << "- " << GetNodeName() << ": Life time factor set." << endl;
             //lout << edev(MLog::eGui);
             return;
@@ -187,5 +189,5 @@
         case 1:
             //lout << ddev(MLog::eGui);
-            lout << "- " << GetNodeName() << ": Status of PDO1 set." << endl;
+            gLog << inf2 << "- " << GetNodeName() << ": Status of PDO1 set." << endl;
             //lout << edev(MLog::eGui);
             return;
@@ -198,5 +200,5 @@
         case 0:
             //lout << ddev(MLog::eGui);
-            lout << "- " << GetNodeName() << ": Velocity set." << endl;
+            gLog << inf2 << "- " << GetNodeName() << ": Velocity set." << endl;
             //lout << edev(MLog::eGui);
             return;
@@ -209,10 +211,10 @@
         case 0:
             //lout << ddev(MLog::eGui);
-            lout << "- " << GetNodeName() << ": Acceleration set." << endl;
+            gLog << inf2 << "- " << GetNodeName() << ": Acceleration set." << endl;
             //lout << edev(MLog::eGui);
             return;
         case 1:
             //lout << ddev(MLog::eGui);
-            lout << "- " << GetNodeName() << ": Deceleration set." << endl;
+            gLog << inf2 << "- " << GetNodeName() << ": Deceleration set." << endl;
             //lout << edev(MLog::eGui);
             return;
@@ -225,5 +227,5 @@
         case 0:
             //lout << ddev(MLog::eGui);
-            lout << "- " << GetNodeName() << ": RPM mode switched." << endl;
+            gLog << inf2 << "- " << GetNodeName() << ": RPM mode switched." << endl;
             //lout << edev(MLog::eGui);
             return;
@@ -245,5 +247,5 @@
     case 0x6000:
         //lout << ddev(MLog::eGui);
-        lout << "- " << GetNodeName() << ": Rotation direction set." << endl;
+        gLog << inf2 << "- " << GetNodeName() << ": Rotation direction set." << endl;
         //lout << edev(MLog::eGui);
         return;
@@ -251,5 +253,5 @@
     case 0x6002:
         //lout << ddev(MLog::eGui);
-        lout << "- " << GetNodeName() << ": Velocitz resolution set." << endl;
+        gLog << inf2 << "- " << GetNodeName() << ": Velocitz resolution set." << endl;
         //lout << edev(MLog::eGui);
         return;
@@ -260,5 +262,5 @@
         case 0:
             //lout << ddev(MLog::eGui);
-            lout << "- " << GetNodeName() << ": Absolute positioning started." << endl;
+            gLog << inf2 << "- " << GetNodeName() << ": Absolute positioning started." << endl;
             //lout << edev(MLog::eGui);
             return;
@@ -266,5 +268,5 @@
         case 1:
             //lout << ddev(MLog::eGui);
-            lout << "- " << GetNodeName() << ": Relative positioning started." << endl;
+            gLog << inf2 << "- " << GetNodeName() << ": Relative positioning started." << endl;
             //lout << edev(MLog::eGui);
             return;
@@ -277,5 +279,5 @@
         case 0:
             //lout << ddev(MLog::eGui);
-            lout << "- " << GetNodeName() << ": Absolute positioning started." << endl;
+            gLog << inf2 << "- " << GetNodeName() << ": Absolute positioning started." << endl;
             //lout << edev(MLog::eGui);
             return;
@@ -283,5 +285,5 @@
         case 1:
             //lout << ddev(MLog::eGui);
-            lout << "- " << GetNodeName() << ": Relative positioning started." << endl;
+            gLog << inf2 << "- " << GetNodeName() << ": Relative positioning started." << endl;
             //lout << edev(MLog::eGui);
             return;
@@ -296,5 +298,5 @@
 void Macs::ReqVelRes()
 {
-    lout << "- " << GetNodeName() << ": Requesting velocity resolution (velres, 0x6002)." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Requesting velocity resolution (velres, 0x6002)." << endl;
     RequestSDO(0x6002);
     WaitForSdo(0x6002);
@@ -303,5 +305,5 @@
 void Macs::ReqRes()
 {
-    lout << "- " << GetNodeName() << ": Requesting encoder resolution (res, 0x6501)." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Requesting encoder resolution (res, 0x6501)." << endl;
     RequestSDO(0x6501);
     WaitForSdo(0x6501);
@@ -310,5 +312,5 @@
 void Macs::SetPDO1On(BYTE_t flag)
 {
-    lout << "- " << GetNodeName() << ": " << (flag?"Enable":"Disable") << " PDO1." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": " << (flag?"Enable":"Disable") << " PDO1." << endl;
     SendSDO(0x1800, 1, (LWORD_t)(flag?0:1)<<31); 
     WaitForSdo(0x1800, 1);           
@@ -322,5 +324,5 @@
     // After this the MACS will react on real movement commands.
     //
-    lout << "- " << GetNodeName() << ": Starting Node." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Starting Node." << endl;
     SendSDO(0x1000, 1, (LWORD_t)1);
     WaitForSdo(0x1000, 1);
@@ -339,10 +341,10 @@
     // error list)
     //
-    lout << "- " << GetNodeName() << ": Requesting Error[0]." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Requesting Error[0]." << endl;
     RequestSDO(0x1003, 2);
     WaitForSdo(0x1003, 2);
     if (HasError())
     {
-        lout << "Macs::Init: " << GetNodeName() << " has error --> ZOMBIE!" << endl;
+        gLog << err << "Macs::Init: " << GetNodeName() << " has error --> ZOMBIE!" << endl;
         SetZombie();
     }
@@ -353,5 +355,5 @@
     StopGuarding();
 
-    lout << "- " << GetNodeName() << ": Requesting Mac Software Version." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Requesting Mac Software Version." << endl;
     RequestSDO(0x100a);
     WaitForSdo(0x100a);
@@ -360,5 +362,5 @@
     if (fSoftVersion<0x00000045) // 00.69
     {
-        lout << GetNodeName() << " - Software Version too old!" << endl;
+        gLog << err << GetNodeName() << " - Software Version too old!" << endl;
         SetZombie();
         return;
@@ -431,5 +433,5 @@
 void Macs::ReqPos()
 {
-    lout << "- " << GetNodeName() << ": Requesting Position." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Requesting Position." << endl;
     RequestSDO(0x6004);
     WaitForSdo(0x6004);
@@ -438,5 +440,5 @@
 void Macs::ReqVel()
 {
-    lout << "- " << GetNodeName() << ": Requesting Velocity." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Requesting Velocity." << endl;
     RequestSDO(0x2002);
     WaitForSdo(0x2002);
@@ -523,5 +525,5 @@
     // or by a positioning command (POSA, ...)
     //
-    lout << "- " << GetNodeName() << ": Starting RPM Sync Mode." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Starting RPM Sync Mode." << endl;
     SendSDO(0x3007, 0, string('s', 'y', 'n', 'c'));
     WaitForSdo(0x3007, 0);
@@ -534,5 +536,5 @@
     // or by a positioning command (POSA, ...)
     //
-    lout << "- " << GetNodeName() << ": Starting Position Sync Mode." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Starting Position Sync Mode." << endl;
     SendSDO(0x3007, 1, string('s', 'y', 'n', 'c'));
     WaitForSdo(0x3007, 1);
@@ -591,6 +593,6 @@
     if (!errnum)
     {
-        lout << "- " << GetNodeName() << ": reports Error occursion." << endl;
-        lout << "Macs::HandlePDO2: " << GetNodeName() << " --> ZOMBIE!" << endl;
+        gLog << err << "- " << GetNodeName() << ": reports Error occursion." << endl;
+        gLog << "Macs::HandlePDO2: " << GetNodeName() << " --> ZOMBIE!" << endl;
         SetZombie();
         SetError(-1);
@@ -604,5 +606,5 @@
     if (GetError()>0)
     {
-        lout << GetNodeName() << ": WARNING! Error #" << GetError() << " unhandled (not cleared) by software." << endl;
+        gLog << warn << GetNodeName() << ": WARNING! Error #" << GetError() << " unhandled (not cleared) by software." << endl;
 
         //
@@ -615,12 +617,12 @@
     SetError(errnum);
 
-    lout << GetNodeName() << " reports: ";
+    gLog << err << GetNodeName() << " reports: ";
     switch (errnum)
     {
     case 3:
-        lout << "Axis does not existing." << endl;
+        gLog << "Axis does not existing." << endl;
         return;
     case 5:
-        lout << "Error not cleared (while trying to move axis)" << endl;
+        gLog << "Error not cleared (while trying to move axis)" << endl;
         return;
     case 6:
@@ -630,16 +632,16 @@
         // from reporting this error a thousands of times.
         //
-        lout << "Home position not the first positioning command." << endl;
+        gLog << "Home position not the first positioning command." << endl;
         SetError(0);
         return;
     case 8:
-        lout << "Control deviation overflow." << endl;
+        gLog << "Control deviation overflow." << endl;
         return;
     case 9:
-        lout << "Zero index not found." << endl;
+        gLog << "Zero index not found." << endl;
         return;
     case 10:
-        lout << "Unknown command, syntax error." << endl;
-        lout << "Please recompile and reload program." << endl;
+        gLog << "Unknown command, syntax error." << endl;
+        gLog << "Please recompile and reload program." << endl;
         return;
     case 11:
@@ -648,71 +650,71 @@
         {
         case -1:
-            lout << "Negative";
+            gLog << "Negative";
             break;
         case 1:
-            lout << "Positive";
+            gLog << "Positive";
             break;
         default:
-            lout << "-unknown-";
+            gLog << "-unknown-";
         }
         switch (errnum)
         {
         case 11:
-            lout << " software";
+            gLog << " software";
             break;
         case 25:
-            lout << " hardware";
+            gLog << " hardware";
             break;
         }
-        lout << " endswitch activated." << endl;
+        gLog << " endswitch activated." << endl;
         return;
     case 12:
-        lout << "Wrong parameter number used in SET command." << endl;
+        gLog << "Wrong parameter number used in SET command." << endl;
         return;
     case 14:
-        lout << " Too many LOOP calls." << endl;
+        gLog << " Too many LOOP calls." << endl;
         return;
     case 16:
-        lout << "Parameter in EEPROM broken (means: EEPROM broken, or saving not finished)" << endl;
-        lout << "Please use APOSS to 'Reset' the MACS and reload the parameters." << endl;
+        gLog << "Parameter in EEPROM broken (means: EEPROM broken, or saving not finished)" << endl;
+        gLog << "Please use APOSS to 'Reset' the MACS and reload the parameters." << endl;
         return;
     case 17:
-        lout << "Program in EEPROM broken (means: EEPROM broken, or saving not finished)" << endl;
-        lout << "Please use APOSS to delete all Programs restore the programs." << endl;
+        gLog << "Program in EEPROM broken (means: EEPROM broken, or saving not finished)" << endl;
+        gLog << "Please use APOSS to delete all Programs restore the programs." << endl;
         return;
     case 18:
-        lout << "Reset by CPU (reset called by Watch-dog cause of CPU halted)" << endl;
-        lout << "Possible reasons: short under-/overvoltage or shortcut." << endl;
+        gLog << "Reset by CPU (reset called by Watch-dog cause of CPU halted)" << endl;
+        gLog << "Possible reasons: short under-/overvoltage or shortcut." << endl;
         return;
     case 19:
-        lout << "User break (autostart program stopped by user)" << endl;
+        gLog << "User break (autostart program stopped by user)" << endl;
         return;
     case 51:
-        lout << "Too many (>=10) GOSUB calls." << endl;
+        gLog << "Too many (>=10) GOSUB calls." << endl;
         return;
     case 52:
-        lout << "Too many RETURN calls." << endl;
+        gLog << "Too many RETURN calls." << endl;
         return;
     case 62:
-        lout << "Error veryfiing EEPROM after access (Try again savaing parameters or program)" << endl;
+        gLog << "Error veryfiing EEPROM after access (Try again savaing parameters or program)" << endl;
         return;
     case 70:
-        lout << "Error in DIM call (call to DIM doesn't fit existing DIM call)" << endl;
+        gLog << "Error in DIM call (call to DIM doesn't fit existing DIM call)" << endl;
         return;
     case 71:
-        lout << "Array out of bound." << endl;
+        gLog << "Array out of bound." << endl;
         return;
     case 79:
-        lout << "Timeout waiting for index (WAITNDX)." << endl;
+        gLog << "Timeout waiting for index (WAITNDX)." << endl;
         return;
     case 84:
-        lout << "Too many (>12) ON TIME calls." << endl;
+        gLog << "Too many (>12) ON TIME calls." << endl;
         return;
     case 87:
-        lout << "Out of memory for variables - Check APOSS predifined number of" << endl;
-        lout << "variables and try deleting the array by doing a 'Reset' from APOSS." << endl;
+        gLog << "Out of memory for variables - Check APOSS predifined number of" << endl;
+        gLog << "variables and try deleting the array by doing a 'Reset' from APOSS." << endl;
         return;
     case 89:
-        lout << "CAN I/O error (REOPEN=" << dec << errinf << " " << (errinf==0?"OK":"ERR") << ")" << endl;
+        gLog << "CAN I/O error (REOPEN=" << dec << errinf << " " << (errinf==0?"OK":"ERR") << ")" << endl;
         return;
 
@@ -723,5 +725,5 @@
 
     default:
-        lout << "Error Nr. " << errnum << ", " << errinf << endl;
+        gLog << "Error Nr. " << errnum << ", " << errinf << endl;
     }
 }
@@ -737,5 +739,5 @@
     time.Now();
 
-    lout << time << ": " << GetNodeName() << " - PDO3 = ";
+    gLog << inf << time << ": " << GetNodeName() << " - PDO3 = ";
     const Bool_t ready = data[3]&0x01;
     const Bool_t fuse  = data[3]&0x02;
@@ -745,12 +747,12 @@
     const Bool_t rf    = data[3]&0x20;
     const Bool_t brake = data[3]&0x40;
-    if (ready) lout << "DKC-Ready ";
-    if (fuse)  lout << "FuseOk ";
-    if (emcy)  lout << "EmcyOk ";
-    if (vltg)  lout << "OvervoltOk ";
-    if (mode)  lout << "SwitchToManualMode ";
-    if (rf)    lout << "RF ";
-    if (brake) lout << "BrakeOpen ";
-    lout << endl;
+    if (ready) gLog << "DKC-Ready ";
+    if (fuse)  gLog << "FuseOk ";
+    if (emcy)  gLog << "EmcyOk ";
+    if (vltg)  gLog << "OvervoltOk ";
+    if (mode)  gLog << "SwitchToManualMode ";
+    if (rf)    gLog << "RF ";
+    if (brake) gLog << "BrakeOpen ";
+    gLog << endl;
 
     fStatusPdo3 = data[3];
@@ -780,5 +782,5 @@
     // we can go on working 'as usual' Eg. Initialize a Display Update
     //
-    cout << GetNodeName() << " Handling Error #" << dec << GetError() << endl;
+    gLog << inf << GetNodeName() << " Handling Error #" << dec << GetError() << endl;
     switch (GetError())
     {
@@ -787,10 +789,10 @@
     case   9: // zero idx
     case  84: // ON TIME
-        lout << "- " << GetNodeName() << ": Cannot handle error #" << GetError() << endl;
+        gLog << "- " << GetNodeName() << ": Cannot handle error #" << GetError() << endl;
         return;
 
     case 11:  // software endswitch
     case 25:  // hardware endswitch
-        lout << "- " << GetNodeName() << ": Cannot handle error 'Endswitch!'" << endl;
+        gLog << "- " << GetNodeName() << ": Cannot handle error 'Endswitch!'" << endl;
         return;
 
@@ -805,5 +807,5 @@
         */
     default:
-        lout << "- " << GetNodeName() << ": Cannot handle error #" << GetError() << endl;
+        gLog << "- " << GetNodeName() << ": Cannot handle error #" << GetError() << endl;
  
     }
@@ -850,6 +852,6 @@
     WaitForSdo(0x100d);
 
-    lout << "- " << GetNodeName() << ": Hostguarding started (" << dec;
-    lout << GetLifeTimeFactor() << "*" << GetGuardTime() << "ms)" << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Hostguarding started (" << dec;
+    gLog << GetLifeTimeFactor() << "*" << GetGuardTime() << "ms)" << endl;
 }
 
@@ -866,5 +868,5 @@
     WaitForSdo(0x100d);
 
-    lout << "- " << GetNodeName() << ": Hostguarding stopped." << endl;
-}
-
+    gLog << inf2 << "- " << GetNodeName() << ": Hostguarding stopped." << endl;
+}
+
Index: /trunk/MagicSoft/Cosy/devdrv/macs.h
===================================================================
--- /trunk/MagicSoft/Cosy/devdrv/macs.h	(revision 8834)
+++ /trunk/MagicSoft/Cosy/devdrv/macs.h	(revision 8835)
@@ -68,5 +68,5 @@
     };
 
-    Macs(const BYTE_t nodeid, const char *name=NULL, MLog &out=gLog);
+    Macs(const BYTE_t nodeid, const char *name=NULL);
     virtual ~Macs();
 
Index: /trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc
===================================================================
--- /trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc	(revision 8834)
+++ /trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc	(revision 8835)
@@ -1,19 +1,18 @@
 #include "shaftencoder.h"
 
+#include <TGLabel.h>       // TGLabel->SetText
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "macs.h"
 #include "network.h"
 
-#include <iostream>        // cout
-#include <iomanip>         // setw, setfill
-
-#include <TGLabel.h>       // TGLabel->SetText
-
-#include "macs.h"
-
 ClassImp(ShaftEncoder);
 
 using namespace std;
 
-ShaftEncoder::ShaftEncoder(const BYTE_t nodeid, const char *name, MLog &out)
-    : NodeDrv(nodeid, name, out),
+ShaftEncoder::ShaftEncoder(const BYTE_t nodeid, const char *name)
+    : NodeDrv(nodeid, name),
     fPos(0), fVel(0), fAcc(0), fTurn(0), fTicks(0),
     fDirection(kUndefined), fHysteresisPos(0), fHysteresisNeg(0),
@@ -40,24 +39,24 @@
     {
     case 0x1000:
-        lout << "- Model: ";
+        gLog << inf2 << "- Model: ";
         switch (val&0xffff)
         {
         case 0x0196:
-            lout << "Shaft Encoder  Type: ";
+            gLog << inf2 << "Shaft Encoder  Type: ";
             switch ((val>>16)&0xff)
             {
             case 0x01:
-                lout << "Singleturn" << endl;
+                gLog << "Singleturn" << endl;
                 return;
             case 0x02:
-                lout << "Multiturn" << endl;
+                gLog << "Multiturn" << endl;
                 return;
             default:
-                lout << "?" << endl;
+                gLog << err << "?" << endl;
                 SetZombie();
                 return;
             }
         default:
-            lout << "???" << endl;
+            gLog << err << "???" << endl;
             SetZombie();
             return;
@@ -69,29 +68,29 @@
 
     case 0x100c:
-        lout << "- Guardtime: " << dec << val << "ms" << endl;
+        gLog << inf2 << "- Guardtime: " << dec << val << "ms" << endl;
         return;
 
     case 0x100d:
-        lout << "- Lifetimefactor: " << dec << val << endl;
+        gLog << inf2 << "- Lifetimefactor: " << dec << val << endl;
         return;
 
     case 0x100e:
-        lout << "- CobId for guarding: 0x" << hex << val << endl;
+        gLog << inf2 << "- CobId for guarding: 0x" << hex << val << endl;
         return;
 
     case 0x6000:
     case 0x6500:
-        lout << "- Counting: " << (val&1 ?"anti-clockwise":"clockwise") << "  ";
-        lout << "HwTest: " <<   (val&2   ?"on":"off") << "  ";
-        lout << "Scaling: " <<  (val&4   ?"on":"off") << "  ";
-        lout << "Modulo: " <<   (val&4096?"on":"off") << endl;
+        gLog << inf2 << "- Counting: " << (val&1 ?"anti-clockwise":"clockwise") << "  ";
+        gLog << "HwTest: " <<   (val&2   ?"on":"off") << "  ";
+        gLog << "Scaling: " <<  (val&4   ?"on":"off") << "  ";
+        gLog << "Modulo: " <<   (val&4096?"on":"off") << endl;
         return;
 
     case 0x6001:
-        lout << "- Logical Ticks/Revolution: " << dec << val << endl;
+        gLog << inf2 << "- Logical Ticks/Revolution: " << dec << val << endl;
         return;
 
     case 0x6004:
-        lout << "- Position: " << dec << val << endl;
+        gLog << inf2 << "- Position: " << dec << val << endl;
         fPos  = val;
         fTurn = 0;
@@ -107,5 +106,5 @@
 
     case 0x6501:
-        lout << "- Phys. Ticks/Revolution: " << dec << val << endl;
+        gLog << inf2 << "- Phys. Ticks/Revolution: " << dec << val << endl;
         fTicks = val;
         return;
@@ -114,5 +113,5 @@
         //if (val==0)
         //    val = 1;  // Single Turn = Multiturn with one turn
-        lout << "- Number of Revolutions: " << dec << val << endl;
+        gLog << inf2 << "- Number of Revolutions: " << dec << val << endl;
         fTurns = val; 
         return;
@@ -120,7 +119,10 @@
 
     }
-    cout << hex << setfill('0');
-    cout << "Sdo=" << idx  << "/" << (int)subidx << ": 0x" << setw(8) << val;
-    cout << endl;
+
+    NodeDrv::HandleSDO(idx, subidx, val, tv);
+
+//    gLog << err << hex << setfill('0');
+//    gLog << "Sdo=" << idx  << "/" << (int)subidx << ": 0x" << setw(8) << val;
+//    gLog << endl;
 }
 
@@ -134,5 +136,5 @@
         case 1:
             //lout << ddev(MLog::eGui);
-            lout << "- " << GetNodeName() << ": PDOs configured." << endl;
+            gLog << inf2 << "- " << GetNodeName() << ": PDOs configured." << endl;
             //lout << edev(MLog::eGui);
             return;
@@ -145,5 +147,5 @@
         case 0:
             //lout << ddev(MLog::eGui);
-            lout << "- " << GetNodeName() << ": Log.ticks/revolution set." << endl;
+            gLog << inf2 << "- " << GetNodeName() << ": Log.ticks/revolution set." << endl;
             //lout << edev(MLog::eGui);
             return;
@@ -156,5 +158,5 @@
         case 0:
             //lout << ddev(MLog::eGui);
-            lout << "- " << GetNodeName() << ": Max number of ticks set." << endl;
+            gLog << inf2 << "- " << GetNodeName() << ": Max number of ticks set." << endl;
             //lout << edev(MLog::eGui);
             return;
@@ -167,5 +169,5 @@
         case 0:
             //lout << ddev(MLog::eGui);
-            lout << "- " << GetNodeName() << ": Preset value set." << endl;
+            gLog << inf2 << "- " << GetNodeName() << ": Preset value set." << endl;
             //lout << edev(MLog::eGui);
             return;
@@ -356,5 +358,5 @@
     // Requesting and checking (FIXME) type of encoder
     //
-    lout << "- " << GetNodeName() << ": Requesting Hardware Type (0x1000)." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Requesting Hardware Type (0x1000)." << endl;
     RequestSDO(0x1000);
     WaitForSdo(0x1000);
@@ -365,5 +367,5 @@
     // Read physical ticks per revolution
     //
-    lout << "- " << GetNodeName() << ": Requesting physical ticks/revolution (SDO 0x6501)." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Requesting physical ticks/revolution (SDO 0x6501)." << endl;
     RequestSDO(0x6501);
     WaitForSdo(0x6501);
@@ -372,5 +374,5 @@
     // Read number of possible ticks per revolution
     //
-    lout << "- " << GetNodeName() << ": Requesting possible ticks/revolution (SDO 0x6502)." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Requesting possible ticks/revolution (SDO 0x6502)." << endl;
     RequestSDO(0x6502);
     WaitForSdo(0x6502);
@@ -389,5 +391,5 @@
     // Set logic ticks/revolution = physical ticks/revolution => scale factor = 1
     //
-    lout << "- " << GetNodeName() << ": Configuring log. tick/rev (0x6001)." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Configuring log. tick/rev (0x6001)." << endl;
     SendSDO(0x6001, fTicks);
     WaitForSdo(0x6001);
@@ -396,5 +398,5 @@
     // Set maximum number of ticks (ticks * turns)
     //
-    lout << "- " << GetNodeName() << ": Configuring max number of ticks (0x6002)." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Configuring max number of ticks (0x6002)." << endl;
     SendSDO(0x6002, (LWORD_t)(fTicks*fTurns));
     WaitForSdo(0x6002);
@@ -403,5 +405,5 @@
     // Delete preset Value
     //
-    lout << "- " << GetNodeName() << ": Delete preset value (0x6003)." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Delete preset value (0x6003)." << endl;
     SendSDO(0x6003, (LWORD_t)0xffffffff);
     WaitForSdo(0x6003);
@@ -410,5 +412,5 @@
     // Configure PDOs
     //
-    lout << "- " << GetNodeName() << ": Configuring PDOs (0x1802)." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Configuring PDOs (0x1802)." << endl;
     SendSDO(0x1802, 1, (LWORD_t)0x281);
     WaitForSdo(0x1802, 1);
@@ -417,5 +419,5 @@
     // Request Parameter
     //
-    lout << "- " << GetNodeName() << ": Requesting SDO 0x6000." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Requesting SDO 0x6000." << endl;
     RequestSDO(0x6000);
     WaitForSdo(0x6000);
@@ -423,5 +425,5 @@
     ReqPos();
 
-    lout << "- " << GetNodeName() << ": Start Node (NMT)." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Start Node (NMT)." << endl;
     SendNMT(kNMT_START);
 
@@ -450,5 +452,5 @@
     // Request Position
     //
-    lout << "- " << GetNodeName() << ": Requesting Position." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Requesting Position." << endl;
     RequestSDO(0x6004);
     WaitForSdo(0x6004);
@@ -457,5 +459,5 @@
 void ShaftEncoder::SetPreset(LWORD_t pre)
 {
-    lout << "- " << GetNodeName() << ": Setting Preset." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Setting Preset." << endl;
 
     SendSDO(0x6003, (LWORD_t)pre);
@@ -476,5 +478,5 @@
 void ShaftEncoder::StopDevice()
 {
-    lout << "- " << GetNodeName() << ": Stop Node (NMT)." << endl;
+    gLog << inf2 << "- " << GetNodeName() << ": Stop Node (NMT)." << endl;
     SendNMT(kNMT_STOP);
 }
Index: /trunk/MagicSoft/Cosy/devdrv/shaftencoder.h
===================================================================
--- /trunk/MagicSoft/Cosy/devdrv/shaftencoder.h	(revision 8834)
+++ /trunk/MagicSoft/Cosy/devdrv/shaftencoder.h	(revision 8835)
@@ -56,5 +56,5 @@
 
 public:
-    ShaftEncoder(const BYTE_t nodeid, const char *name=NULL, MLog &out=gLog);
+    ShaftEncoder(const BYTE_t nodeid, const char *name=NULL);
 
     void StopDevice();
