libt2n: (gerd) fix & improve logging
[libt2n] / src / command_client.cpp
index 0d387b9..a603634 100644 (file)
@@ -25,7 +25,6 @@
 #include <boost/archive/xml_oarchive.hpp>
 #include <boost/archive/xml_iarchive.hpp>
 #include <boost/serialization/serialization.hpp>
-#include <boost/serialization/export.hpp>
 
 #include "command_client.hxx"
 
@@ -43,6 +42,14 @@ void command_client::send_command(command* cmd, result_container &res)
     // TODO: exceptions
     oa << cc;
 
+    std::ostream* ostr;
+    if ((ostr=c.get_logstream(fulldebug))!=NULL)
+    {
+        (*ostr) << "sending command, decoded data: " << std::endl;
+        boost::archive::xml_oarchive xo(*ostr);
+        xo << BOOST_SERIALIZATION_NVP(cc);
+    }
+
     c.write(ofs.str());
 
     // TODO: fix timeout
@@ -55,6 +62,13 @@ void command_client::send_command(command* cmd, result_container &res)
 
     // TODO: exceptions
     ia >> res;
+
+    if ((ostr=c.get_logstream(fulldebug))!=NULL)
+    {
+        (*ostr) << "received result, decoded data: " << std::endl;
+        boost::archive::xml_oarchive xo(*ostr);
+        xo << BOOST_SERIALIZATION_NVP(res);
+    }
 }
 
 }