Robotiq::Logger Class
Minimal logging surface for Robotiq components.
Abstracts logging so the SDK can be used in three contexts:
- Production ROS 2 nodes — adapter forwards to rclcpp's logger
- Standalone CLI / bench tools — default stderr printer (no rclcpp dep)
- Unit tests — null logger or string capture
The interface is tiny by design: one method taking a level and a fully formatted message — formatting is the caller's concern.
- Example — a custom sink
-
void uartWrite(std::string_view) {} // stands in for a real UART driverclass UartLogger : public Robotiq::Logger{public:void log(Level level, std::string_view message) override{if(level >= Level::Warn){uartWrite("!! ");}uartWrite(message);}};void useCustomLogger(){auto logger = std::make_shared<UartLogger>();Robotiq::ConnectionConfig config;Robotiq::Gripper gripper(config, logger);}
Included Headers
Derived Classes
| class | NullLogger |
|
A do-nothing Logger, useful in tight benchmarks or tests. More... | |
| class | StderrLogger |
|
Default Logger implementation that writes to stderr. Hosted-only: it needs <iostream> and a wall clock, neither of which a freestanding target has — provide an application Logger (e.g. a UART sink) there instead. More... | |
Members
| Enumerations | |
| enum class | Level { ... } |
|
Severity of a single log line. More... | |
| Public Destructor | |
| ~Logger ()=default | |
| Public Member Functions | |
| void | log (Level level, std::string_view message)=0 |
|
Emit a fully-formatted log line. More... | |
Public Member Functions
log()
|
Emit a fully-formatted log line.
- Parameters
-
level Severity of this line.
message The already-formatted text to log. The sink decides where it goes (stderr, UART, rclcpp, ...); it does not format, timestamp, or filter by level.
The documentation for this class was generated from the following file:
- logger.hpp
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.