-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: use a lifx lib logger instead of root and suppress #822
Conversation
WalkthroughThe changes focus on standardizing logging practices in the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (4)
- ledfx/main.py (1 hunks)
- ledfx/libraries/lifxdev/init.py (1 hunks)
- ledfx/libraries/lifxdev/devices/device_manager.py (4 hunks)
- ledfx/libraries/lifxdev/messages/packet.py (5 hunks)
Additional comments: 9
ledfx/libraries/lifxdev/__init__.py (1)
- 5-6: The implementation of
get_library_logger
correctly establishes a dedicated logger for thelifxdev
library, aligning with best practices for logging in Python.ledfx/__main__.py (1)
- 99-99: Setting the logging level for "lifxdev" to WARNING within the
setup_logging
function is a strategic decision that aligns with the PR objectives to reduce verbosity. This change is correctly implemented.ledfx/libraries/lifxdev/devices/device_manager.py (1)
- 18-20: The introduction of a logger instance using
get_library_logger()
and the replacement of direct logging calls with this instance are correctly implemented, aligning with the PR objectives to standardize logging across thelifxdev
library.ledfx/libraries/lifxdev/messages/packet.py (6)
- 16-16: The import statement for
get_library_logger
is correctly added to obtain the logger instance for thelifxdev
library. This aligns with the PR objectives to standardize logging through a dedicated logger.- 22-22: The instantiation of the logger using
get_library_logger()
is correctly placed outside of any class or function, ensuring it is available globally within this module. This is a good practice for logging, as it allows for consistent use of the logger throughout the module.- 682-682: The assignment of
self._log_func
based on theverbose
flag is a clever way to dynamically switch between logging levels (info
anddebug
). This approach enhances the flexibility of logging, allowing for more or less verbosity as needed without changing the logging configuration.- 905-905: The use of
log_func
within thesend
method to conditionally log messages at either theinfo
ordebug
level, depending on theverbose
flag, is consistent with the approach taken in thePacketComm
constructor. This consistency in handling verbosity across methods is commendable.- 925-925: Similarly, the use of
log_func
within therecv
method to conditionally log messages at the appropriate level based on theverbose
flag demonstrates a consistent and flexible approach to logging throughout thePacketComm
class.- 16-16: While the import of
get_library_logger
is correctly placed, it's important to ensure that theledfx.libraries.lifxdev
module indeed contains this function. This is a critical dependency for the logging changes to work as intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (3)
- ledfx/libraries/lifxdev/init.py (1 hunks)
- ledfx/libraries/lifxdev/devices/device_manager.py (3 hunks)
- ledfx/libraries/lifxdev/messages/packet.py (5 hunks)
Files skipped from review as they are similar to previous changes (3)
- ledfx/libraries/lifxdev/init.py
- ledfx/libraries/lifxdev/devices/device_manager.py
- ledfx/libraries/lifxdev/messages/packet.py
with -vv lifxdex lib is pumping out message debug each frame.
Existing lib which is carried in our source ( not sure of the history here, not keen on it ) uses the root logger
These changes establish a lifxdev logger in line with the lib naming, and then suppresses to warning by default in ledfx main
Summary by CodeRabbit