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
761 stars 912 forks source link

Ros Logs: Custom Token for ROSCONSOLE_FORMAT #2203

Open kakaday22 opened 2 years ago

kakaday22 commented 2 years ago

Hi, I am new to ROS and I have a requirement that basically I need to add a custom log token into my logs

I understand from the official documentation of these tokens, but now I want to enhance my logs to contain a new token say for example job_id

Token Sample Output
severity ERROR
message hello world 0
time 1284058208.824620563

(if no sim time is available it only shows the wall time) 1284058208.824620563, 1234567890.123456789 (if sim time is available it shows the wall time first and the sim time second) walltime | 1284058208.824620563 (this feature was always available in Python, in C++ it is only available since ros_console version 1.12.6) thread | 0xcd63d0 logger | ros.roscpp_tutorials file | /wg/bvu/jfaust/ros/stacks/ros_tutorials/roscpp_tutorials/talker/talker.cpp line | 92 function | main node | /talker

ideally my ROSCONSOLE_FORMAT would be set to [${severity}] [${time}] [${job_id}] ${message} any help would be useful