Add draft for Centralized Logging and Structured Exception Handling#565
Add draft for Centralized Logging and Structured Exception Handling#565priyan17singh wants to merge 3 commits into
Conversation
|
Hi @dpascualhe, opening this as a draft PR as requested. The core
Happy to proceed with the full migration across the codebase once I have your guidance. Thanks! |
dpascualhe
left a comment
There was a problem hiding this comment.
beyond the requested changes, please make sure to format all your modified files using black
c1ccf02 to
d019e27
Compare
|
Hi @dpascualhe , thanks for the review — I've pushed updates addressing all three comments:
|
Open Questions
Happy to proceed with the full migration once I have guidance on these. Thanks! |
Related to #516
Status
This is a draft PR for early feedback from maintainers before finalizing implementation.
Summary
This PR introduces a centralized logging system to replace scattered
print()usage across the codebase.The goal is to:
The implementation relies only on Python's standard library.
Key Features
Centralized Logging (
logging_config.py)"perceptionmetrics"add_file_handler("logs/run.log")set_level(logging.DEBUG)get_logger("foo")) are normalized under theperceptionmetrics.*hierarchyExample Usage
Logging
Enable File Logging (Optional)
Changes Made
perceptionmetrics/utils/logging_config.pymodels/__init__.pyto use centralized loggingprint()statements with logger usage in modified modulesAdded— removed per review feedbackperceptionmetrics/utils/exception.pyflush()override on the rotating file handlerget_logger()to correctly enforce theperceptionmetrics.*logger hierarchyblackTesting
add_file_handler("logs/run.log"), including directory auto-creation and duplicate-handler prevention