ros2_logging_fmt repository

ros2_logging_fmt repository

ros2_logging_fmt repository

ros2_logging_fmt repository

ros2_logging_fmt

Repository Summary

Description
Checkout URI https://github.com/facontidavide/ros2_logging_fmt.git
VCS Type git
VCS Version master
Last Updated 2022-08-05
Dev Status UNKNOWN
CI status No Continuous Integration
Released UNRELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

Name Version
ros2_logging_fmt 0.0.0

README

ros2_logging_fmt

It is the same as rclcpp logging but much nicer, using fmt instead of printf-like formatting.

Advantages:

  • More type safe that “printf-style” API.
  • Faster execution.
  • Powerful syntax (see examples ).
  • Thread safe.
  • It will not allocate any memory (unless for particularly long messages, and only once).

NOTE: stil under construction. PR and suggestions are welcome.

Example

#include "ros2_logging_fmt/ros2_logging_fmt.hpp"

int main(int argc, char * argv[])
{
  rclcpp::init(argc, argv);
  rclcpp::Node node("test_node");

  std::string world = "world";

  RCLCPP_INFO(node.get_logger(), "Hello %s number %d", world.c_str(), 42);
  RCLCPP_ERROR(node.get_logger(), "We have %d errors", 99);
  RCLCPP_WARN(node.get_logger(), "Warning: %f > %f", 30.1, 30.0);
  RCLCPP_DEBUG(node.get_logger(), "DEBUG MESSAGE");

  ros2_logging_fmt::Logger logger(node.get_logger());

  logger.info("Hello {} number {}", world, 42);
  logger.error("We have {} errors", 99);
  logger.warn("Warning: {} > {}", 30.1, 30.0);
  logger.debug("DEBUG MESSAGE");

  rclcpp::shutdown();
  return 0;
}

CONTRIBUTING

No CONTRIBUTING.md found.

ros2_logging_fmt repository

ros2_logging_fmt repository

ros2_logging_fmt repository

ros2_logging_fmt repository

ros2_logging_fmt repository

ros2_logging_fmt repository

ros2_logging_fmt repository

ros2_logging_fmt repository

ros2_logging_fmt repository

ros2_logging_fmt repository

ros2_logging_fmt repository

ros2_logging_fmt repository

ros2_logging_fmt repository

ros2_logging_fmt repository

ros2_logging_fmt repository