-
Notifications
You must be signed in to change notification settings - Fork 161
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 debug logging #187
Add debug logging #187
Changes from 11 commits
6bc8433
97e25ea
31cec6e
424baba
4de43fa
7adbf48
c240a3c
e682156
6b4818e
1ec2646
fc0df3a
bbece9e
7c7e117
decb56a
88b8bee
5b54487
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,8 @@ rcl_service_init( | |
} | ||
RCL_CHECK_ARGUMENT_FOR_NULL(type_support, RCL_RET_INVALID_ARGUMENT, *allocator); | ||
RCL_CHECK_ARGUMENT_FOR_NULL(service_name, RCL_RET_INVALID_ARGUMENT, *allocator); | ||
RCUTILS_LOG_DEBUG_NAMED( | ||
ROS_PACKAGE_NAME, "Initializing service for service name '%s'", service_name) | ||
if (service->impl) { | ||
RCL_SET_ERROR_MSG("service already initialized, or memory was unintialized", *allocator); | ||
return RCL_RET_ALREADY_INIT; | ||
|
@@ -84,7 +86,7 @@ rcl_service_init( | |
rcutils_ret = rcutils_string_map_fini(&substitutions_map); | ||
if (rcutils_ret != RCUTILS_RET_OK) { | ||
RCUTILS_LOG_ERROR_NAMED( | ||
"rcl", | ||
ROS_PACKAGE_NAME, | ||
"failed to fini string_map (%d) during error handling: %s", | ||
rcutils_ret, | ||
rcutils_get_error_string_safe()) | ||
|
@@ -117,6 +119,7 @@ rcl_service_init( | |
return RCL_RET_ERROR; | ||
} | ||
} | ||
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Expanded service name '%s'", expanded_service_name) | ||
// Validate the expanded service name. | ||
int validation_result; | ||
rmw_ret_t rmw_ret = rmw_validate_full_topic_name(expanded_service_name, &validation_result, NULL); | ||
|
@@ -136,7 +139,7 @@ rcl_service_init( | |
|
||
if (RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL == options->qos.durability) { | ||
RCUTILS_LOG_WARN_NAMED( | ||
"rcl", | ||
ROS_PACKAGE_NAME, | ||
"Warning: Setting QoS durability to 'transient local' for service servers " | ||
"can cause them to receive requests from clients that have since terminated.") | ||
} | ||
|
@@ -155,6 +158,7 @@ rcl_service_init( | |
} | ||
// options | ||
service->impl->options = *options; | ||
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Service initialized") | ||
return RCL_RET_OK; | ||
fail: | ||
if (service->impl) { | ||
|
@@ -166,6 +170,7 @@ rcl_service_init( | |
rcl_ret_t | ||
rcl_service_fini(rcl_service_t * service, rcl_node_t * node) | ||
{ | ||
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Finalizing service") | ||
rcl_ret_t result = RCL_RET_OK; | ||
RCL_CHECK_ARGUMENT_FOR_NULL(service, RCL_RET_INVALID_ARGUMENT, rcl_get_default_allocator()); | ||
RCL_CHECK_ARGUMENT_FOR_NULL(node, RCL_RET_INVALID_ARGUMENT, rcl_get_default_allocator()); | ||
|
@@ -250,6 +255,8 @@ rcl_take_request( | |
RCL_SET_ERROR_MSG(rmw_get_error_string_safe(), options->allocator); | ||
return RCL_RET_ERROR; | ||
} | ||
RCUTILS_LOG_DEBUG_NAMED( | ||
ROS_PACKAGE_NAME, "Service take request succeeded: %s", taken ? "true" : "false") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could add a debug print to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if (!taken) { | ||
return RCL_RET_SERVICE_TAKE_FAILED; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,8 @@ rcl_subscription_init( | |
RCL_CHECK_ARGUMENT_FOR_NULL(subscription, RCL_RET_INVALID_ARGUMENT, *allocator); | ||
RCL_CHECK_ARGUMENT_FOR_NULL(type_support, RCL_RET_INVALID_ARGUMENT, *allocator); | ||
RCL_CHECK_ARGUMENT_FOR_NULL(topic_name, RCL_RET_INVALID_ARGUMENT, *allocator); | ||
RCUTILS_LOG_DEBUG_NAMED( | ||
ROS_PACKAGE_NAME, "Initializing subscription for topic name '%s'", topic_name) | ||
if (subscription->impl) { | ||
RCL_SET_ERROR_MSG("subscription already initialized, or memory was uninitialized", *allocator); | ||
return RCL_RET_ALREADY_INIT; | ||
|
@@ -83,7 +85,7 @@ rcl_subscription_init( | |
rcutils_ret = rcutils_string_map_fini(&substitutions_map); | ||
if (rcutils_ret != RCUTILS_RET_OK) { | ||
RCUTILS_LOG_ERROR_NAMED( | ||
"rcl", | ||
ROS_PACKAGE_NAME, | ||
"failed to fini string_map (%d) during error handling: %s", | ||
rcutils_ret, | ||
rcutils_get_error_string_safe()) | ||
|
@@ -116,6 +118,7 @@ rcl_subscription_init( | |
return RCL_RET_ERROR; | ||
} | ||
} | ||
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Expanded topic name '%s'", expanded_topic_name) | ||
// Validate the expanded topic name. | ||
int validation_result; | ||
rmw_ret_t rmw_ret = rmw_validate_full_topic_name(expanded_topic_name, &validation_result, NULL); | ||
|
@@ -148,6 +151,7 @@ rcl_subscription_init( | |
} | ||
// options | ||
subscription->impl->options = *options; | ||
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Subscription initialized") | ||
return RCL_RET_OK; | ||
fail: | ||
if (subscription->impl) { | ||
|
@@ -159,6 +163,7 @@ rcl_subscription_init( | |
rcl_ret_t | ||
rcl_subscription_fini(rcl_subscription_t * subscription, rcl_node_t * node) | ||
{ | ||
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Finalizing subscription") | ||
rcl_ret_t result = RCL_RET_OK; | ||
RCL_CHECK_ARGUMENT_FOR_NULL(subscription, RCL_RET_INVALID_ARGUMENT, rcl_get_default_allocator()); | ||
RCL_CHECK_ARGUMENT_FOR_NULL(node, RCL_RET_INVALID_ARGUMENT, rcl_get_default_allocator()); | ||
|
@@ -224,6 +229,8 @@ rcl_take( | |
RCL_SET_ERROR_MSG(rmw_get_error_string_safe(), options->allocator); | ||
return RCL_RET_ERROR; | ||
} | ||
RCUTILS_LOG_DEBUG_NAMED( | ||
ROS_PACKAGE_NAME, "Subscription take request succeeded: %s", taken ? "true" : "false") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. copy-n-paste ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed in 88b8bee thanks |
||
if (!taken) { | ||
return RCL_RET_SUBSCRIPTION_TAKE_FAILED; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this add a "client finalized" like it's done in the init function? (same for node and other node entities below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in bbece9e