Skip to content

Commit

Permalink
Adding duplicate node information (#1088)
Browse files Browse the repository at this point in the history
Signed-off-by: CursedRock17 <[email protected]>
Co-authored-by: Chris Lalancette <[email protected]>
  • Loading branch information
CursedRock17 and clalancette authored Aug 24, 2023
1 parent 1a025c6 commit f11fcaa
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions rcl/src/rcl/logging_rosout.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "rcl/logging_rosout.h"

#include "rcl/allocator.h"
#include "rcl/error_handling.h"
#include "rcl/logging_rosout.h"
#include "rcl/node.h"
#include "rcl/publisher.h"
#include "rcl/time.h"
Expand Down Expand Up @@ -250,13 +251,20 @@ rcl_ret_t rcl_logging_rosout_init_publisher_for_node(rcl_node_t * node)
if (rcutils_hash_map_key_exists(&__logger_map, &logger_name)) {
// @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
const char * node_name = rcl_node_get_name(node);
if (NULL == node_name) {
node_name = "unknown node";
}

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 node name: '%s'. If this is due to multiple nodes "
"with the same name then all logs for the logger named '%s' 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.",
node_name,
logger_name);
return RCL_RET_OK;
}

Expand Down

0 comments on commit f11fcaa

Please sign in to comment.