Skip to content

Commit

Permalink
Match logging levels when forwarding to ROS (#128)
Browse files Browse the repository at this point in the history
Signed-off-by: Michel Hidalgo <[email protected]>
  • Loading branch information
mhidalgo-bdai authored Nov 12, 2024
1 parent 23a79c9 commit 5258a5a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bdai_ros2_wrappers/bdai_ros2_wrappers/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
logging.ERROR: LoggingSeverity.ERROR,
logging.CRITICAL: LoggingSeverity.FATAL,
}
REVERSE_SEVERITY_MAP = {v: k for k, v in SEVERITY_MAP.items()}


if not typing.TYPE_CHECKING:
Expand Down Expand Up @@ -327,6 +328,7 @@ def logs_to_ros(node: Node) -> typing.Iterator[None]:
node: a ROS 2 node, necessary for rosout logging (if enabled).
"""
root = logging.getLogger()
root.setLevel(REVERSE_SEVERITY_MAP[node.get_logger().get_effective_level()])
handler = RcutilsLogHandler(node)
root.addHandler(handler)
try:
Expand Down

0 comments on commit 5258a5a

Please sign in to comment.