ros2 / rcl_logging

Logging implementations for ROS 2.
Apache License 2.0
22 stars 35 forks source link

Improve error message handling for spdlog #110

Open christophebedard opened 9 months ago

christophebedard commented 9 months ago

Kind of relates to https://github.com/ros2/rcutils/issues/269

  1. Modify tests to expect the error message to be set when it should be set and then reset it
  2. In rcl_logging_spdlog's rcl_logging_external_initialize(): in case of rcl_logging_get_logging_directory() failure, append error message instead of overwriting it without resetting it (and thus generating a "This error state is being overwritten" warning)
    • The error message looks like:
      Failed to get logging directory: rcutils_join_path failed, at /home/user/ros2_ws/src/ros2/rcl_logging/rcl_logging_interface/src/logging_dir.c:59, at /home/user/ros2_ws/src/ros2/rcl_logging/rcl_logging_spdlog/src/rcl_logging_spdlog.cpp:136
  3. Document that rcl_logging_external_initialize() must/should(?) set an error message if it returns RCL_LOGGING_RET_ERROR

This results in rcl_logging_spdlog/test/test_logging_interface.cpp not generating any "This error state is being overwritten" warnings.

christophebedard commented 9 months ago

This is a draft pending higher-level discussion for overall error message handling.