ros2 / ros2cli

ROS 2 command line interface tools
Apache License 2.0
173 stars 159 forks source link

Command to monitor and pretty print the rosout logs #849

Open guillaumeautran opened 1 year ago

guillaumeautran commented 1 year ago

Enhancement Request

Required Info:

Feature description

Monitoring the rosout logs of a running system from the command line involves running the ros2 topic echo /rosout and dealing with the content of the message AS-IS.

$ ros2 topic echo /rosout
---
stamp:
  sec: 1691614804
  nanosec: 921514406
level: 20
name: rosbag2_player
msg: Set rate to 2.35795
file: /build/source/src/rosbag2_transport/player.cpp
function: set_rate
line: 295
---

Although this works, the results are less than ideal and confusing to read for most users. Doing grep to search the output is made difficult as well and filtering the content for the logs of a specific node is also difficult.

Instead, it would be great to be able to pretty print the rosout logs in a way that makes it appealing and easy to follow. For example:

 $ ros2 rosout print
[2023-08-09 17:02:22.539865596] [INFO ] [rosbag2_player]: Set rate to 2.59374