Skip to content

Add ability to use python logging#12

Merged
erichlf merged 2 commits intohumblefrom
add_python_logging
Mar 28, 2025
Merged

Add ability to use python logging#12
erichlf merged 2 commits intohumblefrom
add_python_logging

Conversation

@erichlf
Copy link
Collaborator

@erichlf erichlf commented Mar 22, 2025

This PR adds the ability to use python logging instead of rclpy.logging and removes the only real ROS2 dependency.

Fixes #8

Motivation and Context

The only real ROS2 dependency of this parser was the rclpy.logging module, so to remove that dependency but still make it possible to use rclpy.logging I added a selector for logging module dependent on if the rclpy.logging module was imported.

Changes

  • Add logging selector

Type of changes

  • New feature

Checklist

  • Update dependencies
  • Update version
  • Update README

Testing

Run the parser on some example trees. If there are no exceptions thrown and the tree is built then it is working.

@erichlf erichlf requested a review from dave992 March 22, 2025 16:46
@erichlf erichlf self-assigned this Mar 28, 2025
@erichlf erichlf added the enhancement New feature or request label Mar 28, 2025
@dave992
Copy link
Member

dave992 commented Mar 28, 2025

I am not sure I really understand the reasons behind this change. Why do we need to be able to use the standard Python logging library instead of rclpy.logging?

From the PR description it seems you want to remove the ROS2 dependency, but this only removes the runtime dependency (this is still a ROS2 package that depends on the ROS2 build system). It is also still the preferred option.

I am also not sure if this solves #8, as this is more of a toggle/fallback than really "injecting an logger". If you want to inject a arbitrary logger I would expect a common interface definition.

The changes itself look good to me.

@erichlf
Copy link
Collaborator Author

erichlf commented Mar 28, 2025

I am not sure I really understand the reasons behind this change. Why do we need to be able to use the standard Python logging library instead of rclpy.logging?

From the PR description it seems you want to remove the ROS2 dependency, but this only removes the runtime dependency (this is still a ROS2 package that depends on the ROS2 build system). It is also still the preferred option.

I am also not sure if this solves #8, as this is more of a toggle/fallback than really "injecting an logger". If you want to inject a arbitrary logger I would expect a common interface definition.

The changes itself look good to me.

The changes here are in the sprit of what I was thinking in #8. After this there is no actually need for ROS2 at all. Sure things are easier if you use colcon build..., but you technically don't need it.

@erichlf erichlf force-pushed the add_python_logging branch from e2f1628 to 6bf1153 Compare March 28, 2025 12:53
@dave992
Copy link
Member

dave992 commented Mar 28, 2025

From our conversation: this MR is part of a bigger move toward making this a pure Python package as there are no real dependencies on ROS 2 (also see #16) other than it using the colcon build system.

@erichlf erichlf merged commit e7983ab into humble Mar 28, 2025
1 check passed
@erichlf erichlf deleted the add_python_logging branch March 28, 2025 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to inject logger

2 participants