Added feature to enable or disable logs through service call #2256
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue aimed
Basically right now there is no way to stop logging during the runtime of rospy node ,event though using service call one cannot disable logs, they can only change the log level of the node.
So to overcome this issue I have basically added a feature to enable/disable logs for any rospy node using base service
set_logger_level
.Approach
To enable/disable logs, one has to pass enable/disable parameter in logger, part of service request.
Sample Service call to disable logging
rosservice call /node_name/set_logger_level "logger: 'disable' level: 'info'"
This will make sure no logs will get dump.
Moreover the logs will automatically get enable if any other logger is set in service request.
Example:
rosservice call /node_name/set_logger_level "logger: 'rospy' level: 'info'"
or using enable parameter
rosservice call /node_name/set_logger_level "logger: 'enable' level: 'info'"
Future
Once this PR is approved I will raise a PR for roscpp part (already tested & created), so that any node can be disable using service call.