diff --git a/src/dynamic_graph/entity-py.cc b/src/dynamic_graph/entity-py.cc index 34d87cdcf9479bd3e807d371f1fcd507d6f5e216..41c4cad69fe1fc545a2301123fc4a02ce620e711 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 45c29e56f817cdcbff257d3c284f8b4425c03bce..c59cfc168ca0b50ba230bafe9fc5f7c758576560 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 803a178050f83fd14a9ab742d466d9cfa052b094..8df5d46465ab9203bb44208081fa76e9944538e0 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; }