Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add change error to warn for multiple loggers #384

Merged
merged 7 commits into from
Feb 7, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions rcl/src/rcl/logging_rosout.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -153,8 +154,11 @@ 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 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.");
nuclearsandwich marked this conversation as resolved.
Show resolved Hide resolved
// RCL_SET_ERROR_MSG("Logger already initialized for node.");
// return RCL_RET_ALREADY_INIT;
nuclearsandwich marked this conversation as resolved.
Show resolved Hide resolved
}

// Create a new Log message publisher on the node
Expand Down