Skip to content

Add support for logging services#643

Open
romainreignier wants to merge 1 commit into
ros2-rust:mainfrom
romainreignier:feature/logging_services
Open

Add support for logging services#643
romainreignier wants to merge 1 commit into
ros2-rust:mainfrom
romainreignier:feature/logging_services

Conversation

@romainreignier
Copy link
Copy Markdown
Contributor

This is my attempt to fix #642, largely inspired by the parameters services.

A few notes:

  • I have gated this feature to avoid humble, the logging services have been added for the Iron release.
  • the node option is called enable_logger_service() and not start_logger_services() like for the parameters because I have used the same wording than rclcpp, is that ok or do you prefer to be consistent with the parameter services option?
  • I have replaced LogSeverity::from_native() that was used only in the tests to LogSeverity::try_from() that seems more idiomatic to me and not panic on error but returns a custom error.
  • I was not sure about how to retrieve the error message from rcutils_logging_set_logger_level() in case of an error to set the reason field of the service response. I must confess that I have followed Claude Code for this:
    let reason = match &err {
        RclrsError::RclError { msg: Some(m), .. }
        | RclrsError::UnknownRclError { msg: Some(m), .. } => m.to_string(),
        other => other.to_string(),
    };

Assisted-by: Claude:claude-4.7-opus

Fixes ros2-rust#642

Signed-off-by: Romain Reignier <rreignier@hiphen-plant.com>
Assisted-by: Claude:claude-4.7-opus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Add support for logging services

1 participant