Open
Description
Description
This issue tracks the refactoring of the colored logging implementation in tests/__init__.py
.
Current Implementation
Currently, the logging setup code is defined directly in tests/__init__.py
to ensure it's loaded very early during test module initialization (before loading multicast).
This includes:
ANSIColors
class for ANSI color codes- Mappings for log levels to colors and logging module levels
ColoredStreamHandler
class extendinglogging.StreamHandler
- Root logger configuration
Proposed Refactoring
Move the implementation to a separate module (e.g., tests/logging_setup.py
or tests/utils/logging.py
) and import it early in tests/__init__.py
to ensure it still takes effect at the appropriate time.
This refactoring would follow SOLID principles:
- Single Responsibility: Separate logging concerns from the test module initialization
- Open/Closed: Allow for future extensions to logging without modifying
tests/__init__.py
- Interface Segregation: Provide a clean interface for the logging functionality
Origin
This refactoring was identified in PR #354: #354 (comment)
Implementation Notes
- Ensure the new module is imported early enough to maintain the current behavior
- Maintain compatibility with existing logging calls
- Add appropriate tests for the new module
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
To do