Skip to content

refactor(gateway): log the HTTP layer through a ROS-free logging interface - #746

Merged
bburda merged 2 commits into
mainfrom
feat/gateway-core-1-logging
Oct 24, 2026
Merged

bburda merged 2 commits into
mainfrom
feat/gateway-core-1-logging

Conversation

@bburda

@bburda bburda commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

The HTTP server, the handlers, aggregation, plugins and the script provider log through a logging interface, with no RCLCPP_* macros. The log sink gets the call site. Log lines keep their logger names.


Issue


Type

  • Bug fix
  • New feature or tests
  • Breaking change
  • Documentation only

Testing

  • ./scripts/test.sh unit --packages-select ros2_medkit_gateway
  • ./scripts/test.sh test_rest_logger_names checks the logger names of the REST layer against a running gateway.

Checklist

  • Breaking changes are clearly described (and announced in docs / changelog if needed)
  • Tests were added or updated if needed
  • Docs were updated if behavior or public API changed

@bburda
bburda added this pull request to stack #755 October 23, 2026 16:45
@bburda bburda self-assigned this Oct 23, 2026
Comment thread src/ros2_medkit_gateway/src/core/logging.cpp Outdated
…rface

Route the HTTP server, handlers, aggregation, plugins and script provider
through a logging interface that does not depend on RCLCPP_* macros. The call
site is passed to the log sink.

The logic behind this layer can then be built and tested without ROS and
without DDS setup.
A log call took a std::shared_ptr copy of the sink through std::atomic_load,
which locks a mutex from a process-wide pool and changes the reference count,
and the call to enabled() did it a second time. The slot now holds a
std::atomic<Sink *> that the log path reads, and set_sink keeps every installed
sink alive until the process exits, so a thread that is logging never uses a
freed sink.

Sink::enabled and Sink::write take the logger name as const std::string &, so the
ROS sink passes c_str() to rcutils without building a string.
@bburda
bburda force-pushed the feat/gateway-core-1-logging branch from f4926be to e6b4fbc Compare October 24, 2026 11:33
@bburda
bburda merged commit 00e6e06 into main Oct 24, 2026
25 checks passed
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.

2 participants