From d48a32214e5fad03f0e98349058756c5dd266e51 Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Fri, 31 Jan 2020 11:46:10 +0100
Subject: [PATCH] Update to changes in dynamic-graph

---
 src/dynamic_graph/entity-py.cc |  8 ++++----
 src/dynamic_graph/entity.py    | 14 +++++++-------
 unitTesting/custom_entity.cpp  | 22 ++++++++++------------
 3 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/src/dynamic_graph/entity-py.cc b/src/dynamic_graph/entity-py.cc
index 34d87cd..41c4cad 100644
--- a/src/dynamic_graph/entity-py.cc
+++ b/src/dynamic_graph/entity-py.cc
@@ -458,19 +458,19 @@ PyObject* setLoggerVerbosityLevel(
 
   try {
     switch (verbosityLevel) {
-      case 0:
+      case 8:
         entity->setLoggerVerbosityLevel(VERBOSITY_ALL);
         break;
-      case 1:
+      case 4:
         entity->setLoggerVerbosityLevel(VERBOSITY_INFO_WARNING_ERROR);
         break;
       case 2:
         entity->setLoggerVerbosityLevel(VERBOSITY_WARNING_ERROR);
         break;
-      case 3:
+      case 1:
         entity->setLoggerVerbosityLevel(VERBOSITY_ERROR);
         break;
-      case 4:
+      case 0:
         entity->setLoggerVerbosityLevel(VERBOSITY_NONE);
         break;
       default:
diff --git a/src/dynamic_graph/entity.py b/src/dynamic_graph/entity.py
index 45c29e5..c59cfc1 100644
--- a/src/dynamic_graph/entity.py
+++ b/src/dynamic_graph/entity.py
@@ -73,11 +73,11 @@ class VerbosityLevel(Enum):
     """
     Enum class for setVerbosityLevel
     """
-    VERBOSITY_ALL = 0
-    VERBOSITY_INFO_WARNING_ERROR = 1
+    VERBOSITY_ALL = 8
+    VERBOSITY_INFO_WARNING_ERROR = 4
     VERBOSITY_WARNING_ERROR = 2
-    VERBOSITY_ERROR = 3
-    VERBOSITY_NONE = 4
+    VERBOSITY_ERROR = 1
+    VERBOSITY_NONE = 0
 
 
 class Entity(object):
@@ -271,13 +271,13 @@ class Entity(object):
         Returns the entity's verbosity level (as a dynamic_graph.entity.VerbosityLevel)
         """
         r = wrap.entity_get_logger_verbosity(self.obj)
-        if r == 0:
+        if r == 8:
             return VerbosityLevel.VERBOSITY_ALL
-        elif r == 1:
+        elif r == 4:
             return VerbosityLevel.VERBOSITY_INFO_WARNING_ERROR
         elif r == 2:
             return VerbosityLevel.VERBOSITY_WARNING_ERROR
-        elif r == 3:
+        elif r == 1:
             return VerbosityLevel.VERBOSITY_ERROR
         return VerbosityLevel.VERBOSITY_NONE
 
diff --git a/unitTesting/custom_entity.cpp b/unitTesting/custom_entity.cpp
index 803a178..8df5d46 100644
--- a/unitTesting/custom_entity.cpp
+++ b/unitTesting/custom_entity.cpp
@@ -48,18 +48,16 @@ class CustomEntity : public Entity {
   double &update(double &res, const int &inTime) {
     const double &aDouble = m_sigdSIN(inTime);
     res = aDouble;
-    std::ostringstream oss;
-    oss << "start update " << res;
-    sendMsg(oss.str().c_str(), MSG_TYPE_ERROR);
-    sendMsg("This is a message of level MSG_TYPE_DEBUG", MSG_TYPE_DEBUG, __FILE__, __LINE__);
-    sendMsg("This is a message of level MSG_TYPE_INFO", MSG_TYPE_INFO, __FILE__, __LINE__);
-    sendMsg("This is a message of level MSG_TYPE_WARNING", MSG_TYPE_WARNING, __FILE__, __LINE__);
-    sendMsg("This is a message of level MSG_TYPE_ERROR", MSG_TYPE_ERROR, __FILE__, __LINE__);
-    sendMsg("This is a message of level MSG_TYPE_DEBUG_STREAM", MSG_TYPE_DEBUG_STREAM, __FILE__, __LINE__);
-    sendMsg("This is a message of level MSG_TYPE_INFO_STREAM", MSG_TYPE_INFO_STREAM, __FILE__, __LINE__);
-    sendMsg("This is a message of level MSG_TYPE_WARNING_STREAM", MSG_TYPE_WARNING_STREAM, __FILE__, __LINE__);
-    sendMsg("This is a message of level MSG_TYPE_ERROR_STREAM", MSG_TYPE_ERROR_STREAM, __FILE__, __LINE__);
-    sendMsg("end update", MSG_TYPE_ERROR, __FILE__, __LINE__);
+    logger().stream(MSG_TYPE_ERROR) << "start update " << res << '\n';
+    DYNAMIC_GRAPH_ENTITY_DEBUG   (*this) << "This is a message of level MSG_TYPE_DEBUG\n";
+    DYNAMIC_GRAPH_ENTITY_INFO    (*this) << "This is a message of level MSG_TYPE_INFO\n";
+    DYNAMIC_GRAPH_ENTITY_WARNING (*this) << "This is a message of level MSG_TYPE_WARNING\n";
+    DYNAMIC_GRAPH_ENTITY_ERROR   (*this) << "This is a message of level MSG_TYPE_ERROR\n";
+    DYNAMIC_GRAPH_ENTITY_DEBUG_STREAM   (*this) << "This is a message of level MSG_TYPE_DEBUG_STREAM\n";
+    DYNAMIC_GRAPH_ENTITY_INFO_STREAM    (*this) << "This is a message of level MSG_TYPE_INFO_STREAM\n";
+    DYNAMIC_GRAPH_ENTITY_WARNING_STREAM (*this) << "This is a message of level MSG_TYPE_WARNING_STREAM\n";
+    DYNAMIC_GRAPH_ENTITY_ERROR_STREAM   (*this) << "This is a message of level MSG_TYPE_ERROR_STREAM\n";
+    logger().stream(MSG_TYPE_ERROR) << "end update\n";
     return res;
   }
 
-- 
GitLab