Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Some code refactoring
[simgrid.git] / src / cxx / Msg.cxx
index 443ac6b..daac88e 100644 (file)
 \r
 \r
 #include <Msg.hpp>\r
+#include <Host.hpp>\r
+#include <Process.hpp>\r
+\r
 \r
 #include <msg/msg.h>\r
 #include <msg/private.h>\r
-#include <stdio.h>\r
 \r
+#include <iostream>\r
+using std::cout;\r
+using std::endl;\r
+using std::streamsize;\r
+\r
+#include <iomanip>\r
+using std::setprecision;\r
+using std::setw;\r
 \r
 \r
 \r
@@ -46,10 +56,72 @@ namespace SimGrid
                        \r
                }\r
                \r
+               void info(const StringHelper& s)\r
+               {\r
+                       StringHelper clock;\r
+                       \r
+                       cout << "[";\r
+                       cout << Host::currentHost().getName();\r
+                       cout << ":";\r
+                       cout << Process::currentProcess().getName();\r
+                       cout << ":(";\r
+                       cout << Process::currentProcess().getPID();\r
+                       cout << ") " ;\r
+                       cout << clock.append(getClock(), "%07lf");\r
+                       cout << "] [cxx4msg/INFO] ";\r
+                       cout << s;\r
+                       cout << endl;\r
+               }\r
+\r
                void info(const char* s)\r
                {\r
-                        //INFO1("%s",s);\r
-                       printf("[SimGridX/info] %s\n", s);\r
+                       StringHelper clock;\r
+                       \r
+                       cout << "[";\r
+                       cout << Host::currentHost().getName();\r
+                       cout << ":";\r
+                       cout << Process::currentProcess().getName();\r
+                       cout << ":(";\r
+                       cout << Process::currentProcess().getPID();\r
+                       cout << ") " ;\r
+                       cout << clock.append(getClock(), "%07lf");\r
+                       cout << "] [cxx4msg/INFO] ";\r
+                       cout << s;\r
+                       cout << endl;\r
+               }\r
+\r
+               void error(const StringHelper& s)\r
+               {\r
+                       StringHelper clock;\r
+                       \r
+                       cout << "[";\r
+                       cout << Host::currentHost().getName();\r
+                       cout << ":";\r
+                       cout << Process::currentProcess().getName();\r
+                       cout << ":(";\r
+                       cout << Process::currentProcess().getPID();\r
+                       cout << ") " ;\r
+                       cout << clock.append(getClock(), "%07lf");\r
+                       cout << "] [cxx4msg/ERROR] ";\r
+                       cout << s;\r
+                       cout << endl;\r
+               }\r
+\r
+               void error(const char* s)\r
+               {\r
+                       StringHelper clock;\r
+                       \r
+                       cout << "[";\r
+                       cout << Host::currentHost().getName();\r
+                       cout << ":";\r
+                       cout << Process::currentProcess().getName();\r
+                       cout << ":(";\r
+                       cout << Process::currentProcess().getPID();\r
+                       cout << ") " ;\r
+                       cout << clock.append(getClock(), "%07lf");\r
+                       cout << "] [cxx4msg/ERROR] ";\r
+                       cout << s;\r
+                       cout << endl;\r
                }\r
 \r
                double getClock(void)\r