-
Notifications
You must be signed in to change notification settings - Fork 516
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
What happened?
Description
The backend/app/utils/images.py file contains duplicate logger initialization, causing the custom configured logger to be overwritten by a standard Python logger. This results in inconsistent logging behavior and loss of the project's custom logging configuration (color formatting, component prefixes, etc.).
Location
File: backend/app/utils/images.py
Lines: 23 and 29
Problem
- Duplicate Initialization: The logger is initialized twice on lines 23 and 29
- Overwrites Custom Logger: The second initialization uses
logging.getLogger()instead of the project'sget_logger(), which overwrites the properly configured logger - Unused Import: The
loggingmodule is imported but only used for the duplicate initialization - Loss of Configuration: The custom logger from
get_logger()includes:- Color-coded log messages
- Component-specific prefixes
- Consistent formatting across the project
- Environment-based configuration
Impact
- Inconsistent Logging: Logs from this module may not follow the project's logging standards
- Lost Formatting: Missing color coding and component prefixes in log output
- Code Quality: Unused import and redundant code
- Maintenance: Confusing for developers who expect consistent logging behavior
Expected Behavior
The module should use a single logger instance initialized with the project's custom get_logger() function, ensuring consistent logging behavior with proper formatting and configuration.
Solution
- Remove the duplicate logger initialization on line 29
- Remove the unused
import loggingstatement - Keep only the correct initialization:
logger = get_logger(__name__)
Steps to Reproduce
- Check the log output from image processing operations
- Observe that logs may not have the expected formatting/colors
- Review the code to see duplicate logger initialization
Additional Context
- The project uses a centralized logging system via
app.logging.setup_logging.get_logger() - This function returns a properly configured logger with custom formatting
- All modules should use
get_logger(__name__)instead oflogging.getLogger(__name__)
Labels
bugbackendloggingcode-qualitygood-first-issue(simple fix, good for new contributors)
Priority
Low-Medium - Doesn't break functionality but affects code quality and logging consistency
Record
- I agree to follow this project's Code of Conduct
Checklist before Submitting
- Have you updated docs for it?
- Have you added unit tests?
- Have you made sure unit tests pass?
- Have you made sure code formatting is correct?
- Do Your changes passes all tests?
coderabbitai