No version for distro humble showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro jazzy showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro kilted showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro ardent showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro bouncy showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro crystal showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro eloquent showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro dashing showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro galactic showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro foxy showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro iron showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro lunar showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro jade showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro indigo showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro hydro showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro kinetic showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro melodic showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file

No version for distro noetic showing rolling. Known supported distros are highlighted in the buttons above.
Repo symbol

ros2_fmt_logger repository

ros2_fmt_logger

ROS Distro
rolling

Repository Summary

Checkout URI https://github.com/nobleo/ros2_fmt_logger.git
VCS Type git
VCS Version main
Last Updated 2025-10-08
Dev Status DEVELOPED
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
ros2_fmt_logger 1.0.0

README

ros2_fmt_logger

A modern, ROS 2 logging library that provides fmt-style formatting as a replacement for RCLCPP logging macros.

Features

  • Function calls instead of macros: logger.info("Hello, {}!", name) instead of RCLCPP_INFO(logger, "Hello, %s", name.c_str())
  • Additional .on_change() method for logging changes in values
  • chrono syntax for throttling: logger.warn_throttle(1s, "Warning: {}", value)

Examples

Once-only logging

logger.info_once("This message will only appear once, no matter how many times called");

Throttled logging

using std::chrono_literals::operator""s;
logger.warn_throttle(1s, "This warning appears at most once per second: {}", value);

Change-based logging

// Log only when the value changes
logger.info_on_change(sensor_value, "Sensor reading changed to: {}", sensor_value);

// Log only when change exceeds threshold
logger.error_on_change(temperature, 5.0, "Temperature changed significantly: {:.1f}°C", temperature);

Quick Start

Include in the package.xml

<depend>ros2_fmt_logger</depend>

Configure c++20 and find_package

find_package(ros2_fmt_logger REQUIRED)
target_link_libraries(your_target ros2_fmt_logger::ros2_fmt_logger)

Include the header

#include <ros2_fmt_logger/ros2_fmt_logger.hpp>

Create a logger instance

// From an rclcpp::Logger
auto logger = ros2_fmt_logger::Logger(node->get_logger());

// With custom clock for throttling features
auto logger = ros2_fmt_logger::Logger(node->get_logger(), node->get_clock());

3. Use modern logging syntax

// Instead of: RCLCPP_INFO(logger, "Processing item %d with value %.2f", id, value);
logger.info("Processing item {} with value {:.2f}", id, value);

// Instead of: RCLCPP_ERROR(logger, "Failed to connect to %s:%d", host.c_str(), port);
logger.error("Failed to connect to {}:{}", host, port);

Format String Syntax

Uses the powerful fmt library format syntax:

// Basic formatting
logger.info("Hello, {}!", name);

// Positional arguments
logger.info("Processing {1} of {0} items", total, current);

// Format specifiers
logger.info("Progress: {:.1%}", progress);  // Percentage with 1 decimal
logger.info("Value: {:08.2f}", value);     // Zero-padded floating point
logger.info("Hex: {:#x}", number);         // Hexadecimal with 0x prefix

// Container formatting (requires fmt/ranges.h)
logger.info("Values: {}", std::vector{1, 2, 3, 4});

See demo_ros2_fmt_logger.cpp for more examples.

File truncated at 100 lines see the full file