From 7f80f73b4f82cb111d2052a16f6c2bb78d074c4d Mon Sep 17 00:00:00 2001 From: Ross Desmond Date: Thu, 7 Feb 2019 20:12:13 +0000 Subject: [PATCH 1/7] Add change error to warn for multiple loggers --- rcl/src/rcl/logging_rosout.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rcl/src/rcl/logging_rosout.c b/rcl/src/rcl/logging_rosout.c index 067f7e945..1e175e650 100644 --- a/rcl/src/rcl/logging_rosout.c +++ b/rcl/src/rcl/logging_rosout.c @@ -21,6 +21,7 @@ #include "rcl/visibility_control.h" #include "rcl_interfaces/msg/log.h" #include "rcutils/allocator.h" +#include "rcutils/logging_macros.h" #include "rcutils/macros.h" #include "rcutils/types/hash_map.h" #include "rcutils/types/rcutils_ret.h" @@ -153,8 +154,10 @@ rcl_ret_t rcl_logging_rosout_init_publisher_for_node( return RCL_RET_ERROR; } if (rcutils_hash_map_key_exists(&__logger_map, &logger_name)) { - RCL_SET_ERROR_MSG("Logger already initialized for node."); - return RCL_RET_ALREADY_INIT; + // @todo: nburek enfornce node name unique + RCUTILS_LOG_WARN_NAMED("log_infrastructure", "Logger already initialized for node"); + // RCL_SET_ERROR_MSG("Logger already initialized for node."); + // return RCL_RET_ALREADY_INIT; } // Create a new Log message publisher on the node From 5c80cde4afdf5739f0afb2624a3892aede026539 Mon Sep 17 00:00:00 2001 From: Nick Burek Date: Thu, 7 Feb 2019 12:53:31 -0800 Subject: [PATCH 2/7] Updating warning message --- rcl/src/rcl/logging_rosout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rcl/src/rcl/logging_rosout.c b/rcl/src/rcl/logging_rosout.c index 1e175e650..7bd6a0d4a 100644 --- a/rcl/src/rcl/logging_rosout.c +++ b/rcl/src/rcl/logging_rosout.c @@ -155,7 +155,7 @@ rcl_ret_t rcl_logging_rosout_init_publisher_for_node( } if (rcutils_hash_map_key_exists(&__logger_map, &logger_name)) { // @todo: nburek enfornce node name unique - RCUTILS_LOG_WARN_NAMED("log_infrastructure", "Logger already initialized for node"); + RCUTILS_LOG_WARN_NAMED("log_infrastructure", "Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from going out over the rosout topic."); // RCL_SET_ERROR_MSG("Logger already initialized for node."); // return RCL_RET_ALREADY_INIT; } From 56309827ccdd46ec3a6c349d6e6a8d0ed589b205 Mon Sep 17 00:00:00 2001 From: Nick Burek Date: Thu, 7 Feb 2019 13:26:26 -0800 Subject: [PATCH 3/7] Updating TODO message. --- rcl/src/rcl/logging_rosout.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rcl/src/rcl/logging_rosout.c b/rcl/src/rcl/logging_rosout.c index 7bd6a0d4a..b34a32f2b 100644 --- a/rcl/src/rcl/logging_rosout.c +++ b/rcl/src/rcl/logging_rosout.c @@ -154,7 +154,8 @@ rcl_ret_t rcl_logging_rosout_init_publisher_for_node( return RCL_RET_ERROR; } if (rcutils_hash_map_key_exists(&__logger_map, &logger_name)) { - // @todo: nburek enfornce node name unique + // @todo: nburek Update behavior to either enforce unique names or work with non-unique + // names based on the outcome here: https://github.com/ros2/design/issues/187 RCUTILS_LOG_WARN_NAMED("log_infrastructure", "Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from going out over the rosout topic."); // RCL_SET_ERROR_MSG("Logger already initialized for node."); // return RCL_RET_ALREADY_INIT; From 95bc47233342adc5b5c97c9c648456cf73a543b6 Mon Sep 17 00:00:00 2001 From: burekn Date: Thu, 7 Feb 2019 13:34:02 -0800 Subject: [PATCH 4/7] Reformatting todo and uncrustify warn message. --- rcl/src/rcl/logging_rosout.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rcl/src/rcl/logging_rosout.c b/rcl/src/rcl/logging_rosout.c index b34a32f2b..fcb813ce1 100644 --- a/rcl/src/rcl/logging_rosout.c +++ b/rcl/src/rcl/logging_rosout.c @@ -154,9 +154,10 @@ rcl_ret_t rcl_logging_rosout_init_publisher_for_node( return RCL_RET_ERROR; } if (rcutils_hash_map_key_exists(&__logger_map, &logger_name)) { - // @todo: nburek Update behavior to either enforce unique names or work with non-unique + // @TODO(nburek) Update behavior to either enforce unique names or work with non-unique // names based on the outcome here: https://github.com/ros2/design/issues/187 - RCUTILS_LOG_WARN_NAMED("log_infrastructure", "Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from going out over the rosout topic."); + RCUTILS_LOG_WARN_NAMED("rcl.logging_rosout", + "Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic."); // RCL_SET_ERROR_MSG("Logger already initialized for node."); // return RCL_RET_ALREADY_INIT; } From 24dea8922e65e31874a1b9ae1283b76717ddb442 Mon Sep 17 00:00:00 2001 From: burekn Date: Thu, 7 Feb 2019 13:36:42 -0800 Subject: [PATCH 5/7] Add early return back in. --- rcl/src/rcl/logging_rosout.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rcl/src/rcl/logging_rosout.c b/rcl/src/rcl/logging_rosout.c index fcb813ce1..8e2211111 100644 --- a/rcl/src/rcl/logging_rosout.c +++ b/rcl/src/rcl/logging_rosout.c @@ -160,6 +160,7 @@ rcl_ret_t rcl_logging_rosout_init_publisher_for_node( "Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic."); // RCL_SET_ERROR_MSG("Logger already initialized for node."); // return RCL_RET_ALREADY_INIT; + return RCL_RET_OK; } // Create a new Log message publisher on the node From 884dc9048302381c9222fad5ed817df3a4ac4d6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnar=C3=B6k?= Date: Thu, 7 Feb 2019 14:51:24 -0800 Subject: [PATCH 6/7] Break string literal across multiple lines. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Steven! Ragnarök --- rcl/src/rcl/logging_rosout.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rcl/src/rcl/logging_rosout.c b/rcl/src/rcl/logging_rosout.c index 8e2211111..c375e2fa7 100644 --- a/rcl/src/rcl/logging_rosout.c +++ b/rcl/src/rcl/logging_rosout.c @@ -157,7 +157,11 @@ rcl_ret_t rcl_logging_rosout_init_publisher_for_node( // @TODO(nburek) Update behavior to either enforce unique names or work with non-unique // names based on the outcome here: https://github.com/ros2/design/issues/187 RCUTILS_LOG_WARN_NAMED("rcl.logging_rosout", - "Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic."); + "Publisher already registered for provided node name. If this is due to multiple nodes " + "with the same name then all logs for that logger name will go out over the existing " + "publisher. As soon as any node with that name is destructed it will unregister the " + "publisher, preventing any further logs for that name from being published on the rosout " + "topic."); // RCL_SET_ERROR_MSG("Logger already initialized for node."); // return RCL_RET_ALREADY_INIT; return RCL_RET_OK; From db9954b552ae6fe56827aef8ef307ae7bc3a7fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnar=C3=B6k?= Date: Thu, 7 Feb 2019 15:04:01 -0800 Subject: [PATCH 7/7] Remove commented-out error and return block. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Steven! Ragnarök --- rcl/src/rcl/logging_rosout.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/rcl/src/rcl/logging_rosout.c b/rcl/src/rcl/logging_rosout.c index c375e2fa7..0f4ed0d8e 100644 --- a/rcl/src/rcl/logging_rosout.c +++ b/rcl/src/rcl/logging_rosout.c @@ -162,8 +162,6 @@ rcl_ret_t rcl_logging_rosout_init_publisher_for_node( "publisher. As soon as any node with that name is destructed it will unregister the " "publisher, preventing any further logs for that name from being published on the rosout " "topic."); - // RCL_SET_ERROR_MSG("Logger already initialized for node."); - // return RCL_RET_ALREADY_INIT; return RCL_RET_OK; }