ros / ros_comm

ROS communications-related packages, including core client libraries (roscpp, rospy, roslisp) and graph introspection tools (rostopic, rosnode, rosservice, rosparam).
http://wiki.ros.org/ros_comm
753 stars 911 forks source link

Fix: rospy logger format %f microseconds #2367

Closed rafa-martin closed 5 months ago

rafa-martin commented 8 months ago

With the following ROSCONSOLE_FORMAT=[${severity}] [${time:%Y-%m-%d %H:%M:%S.%f}] ... the console output from rospy info function:

[INFO] [2024-01-16 23:46:27.%f] ...

The problem here is, date class does't use "%f" to match microseconds link.

This issue can be addressed to way:

  1. Calculate microseconds and replace each "%f" with calculated
  2. Change time class to datetime class

This PR uses first aproach. Now output of python node is:

[INFO] [2024-01-16 23:46:27.920983] ...

Aditional info:

peci1 commented 7 months ago

I've implemented option 2 in https://github.com/ros/ros_comm/pull/2370 .