-
Notifications
You must be signed in to change notification settings - Fork 136
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 support for logging #184
Comments
Can w discuss an idea of logging API? Even empty interfaces would unblock work on #167. |
@Nizerlak Ok, did you want to present an idea of your own or should I expand on my comment above? |
I don't feel to propose an idea other than making something similar to rclcpp. Anyway I think, that making macros (I suppose they will be used like in rclcpp) design would be a good point to start. |
The log crate mentioned above already defines logging macros. We'd just have to implement the backend that logs to rosout. |
Yes, |
Is this still being discussed/desired? I was hoping to contribute to it or get it started. I was thinking of extending |
I'm also willing to work on this. I took a bit of a deep dive into logging in rclrs::log::info!(&node.get_logger(), "Hello {}!", "World");
rclrs::log::fatal!(&node.get_logger(), "Some FATAL {}", "message");
rclrs::log::warn_once!(&node.get_logger(), "Some WARNING {}", "message");
rclrs::log::debug_skip_first!(&node.get_logger(), "Some DEBUG {}", "message"); |
@Chake96 Absolutely, it still makes sense to have logging in rclrs. I'm not sure what exactly you mean by "extending" @Cyberunner23 Yeah, we can probably do something similar. You might be able to make the interface slightly nicer by overloading the log macros, like
for the expression variant. |
Hi, if anyone end up here looking for a solution to make ros2_rust logs output looks like the rclcpp one, you can use :
And initializing the logger like :
Do not forget to set env variable : |
I would like to contribute to the My PR is based off the effort from the r2r logging discussion, although I've had to make additional changes to allow the logging library to use the /rosout topic. Hopefully the changes/plan are acceptable. Some caveats to note: I'm very new to rust, ros2 and contributing to open source so I've probably made some missteps in at least one of those areas. |
@geoff-imdex Thanks for putting that PR together! Currently, it's targeting the |
Thanks for the heads-up - I've created this PR 422. I looking forward to getting some feedback - hopefully my first rust PR isn't too bad! :-) |
Some very rough initial thoughts: It would be nice if users could use the standard
log
crate to log messages, which are then handled appropriately – for instance, sent to/rosout
if that was enabled in the node. Adding a handler that sends logs to/rosout
is possible and whatlog
is designed to do, and the enabled/disabled would have to be checked via thetarget
of the log message.The text was updated successfully, but these errors were encountered: