feat(logging): draft implementation of centralized logging and exception handling.#564
Closed
priyan17singh wants to merge 3 commits intoJdeRobot:masterfrom
Closed
feat(logging): draft implementation of centralized logging and exception handling.#564priyan17singh wants to merge 3 commits intoJdeRobot:masterfrom
priyan17singh wants to merge 3 commits intoJdeRobot:masterfrom
Conversation
Contributor
Author
|
Had some unexpected changes in the files. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Centralized Logging and Structured Exception Handling
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 and a structured exception wrapper to replace scattered
print()usage and raw exceptions across the codebase.The goal is to:
The implementation relies only on Python’s standard library.
Key Features
1. Centralized Logging (
logging_config.py)"perceptionmetrics"add_file_handler("logs/run.log")set_level(logging.DEBUG)2. Structured Exception Wrapper (
exception.py)PerceptionMetricsExceptionError in [file.py] at line [42]: original error messageExample Usage
Logging
from perceptionmetrics.utils.logging_config import get_logger_logger = get_logger(__name__)_logger.info("Loaded %d samples", n)Enable File Logging (Optional)
from perceptionmetrics.utils.logging_config import add_file_handleradd_file_handler("logs/run.log")Exception Handling
Changes Made
perceptionmetrics/utils/logging_config.pyperceptionmetrics/utils/exception.pymodels/__init__.pyto use centralized logging and structured exceptions.print()statements with logger usage in modified modules.Testing
add_file_handler("logs/run.log")