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

Adding duplicate node information #1088

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Changes from all 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
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.");
fujitatomoya marked this conversation as resolved.
Show resolved Hide resolved
"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