Skip to content

fix(logging): replace bare logging.getLogger with project get_logger … - #1516

Open
Aditya30ag wants to merge 1 commit into
AOSSIE-Org:mainfrom
Aditya30ag:fix/inconsistent-logger-usage
Open

fix(logging): replace bare logging.getLogger with project get_logger …#1516
Aditya30ag wants to merge 1 commit into
AOSSIE-Org:mainfrom
Aditya30ag:fix/inconsistent-logger-usage

Conversation

@Aditya30ag

@Aditya30ag Aditya30ag commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Three backend modules used Python's stdlib logging.getLogger directly instead of the project's get_logger from app.logging.setup_logging, causing their log output to bypass colour formatting, [COMPONENT] prefixes, and environment-level filtering.

backend/app/utils/images.py was the most severe case get_logger was assigned correctly on line 35, then silently overwritten two lines later:

logger = get_logger(__name__)        # line 35 correct
...
logger = logging.getLogger(__name__) # line 41 overwrites the above

backend/app/routes/face_clusters.py and backend/app/routes/models.py simply never adopted the pattern used by all 7 of their sibling route files.

Fixed by removing the duplicate assignment and redundant import logging in images.py, and replacing logging.getLogger with get_logger (plus the matching import) in face_clusters.py and models.py. get_logger is a thin wrapper around logging.getLogger log propagation and levels are completely unchanged.

Addressed Issues:

Fixes #1515

Additional Notes:

No logic change across any of the three files. Only affects log output formatting and consistency.

AI Usage Disclosure:

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the [Discord server](https://discord.gg/hjUhu33uAn) and I will share a link to this PR with the project maintainers there
  • I have read the [Contribution Guidelines](../CONTRIBUTING.md)
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

Summary by CodeRabbit

  • Chores
    • Standardized application logging across face clustering, model routes, and image utilities.
    • Improved consistency of internal log configuration without changing user-facing functionality.

@github-actions github-actions Bot added bug Something isn't working enhancement New feature or request possible-duplicate Potential semantic duplicate (upstream comparison) labels Aug 29, 2026
@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c6700eab-dba2-4c9f-92ab-f76ab957dbc1

📥 Commits

Reviewing files that changed from the base of the PR and between 4302258 and 96f824d.

📒 Files selected for processing (3)
  • backend/app/routes/face_clusters.py
  • backend/app/routes/models.py
  • backend/app/utils/images.py
💤 Files with no reviewable changes (1)
  • backend/app/utils/images.py

Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review.


Walkthrough

The change replaces direct standard-library logger initialization with get_logger in three backend modules. Existing application logic remains unchanged.

Changes

Application logger standardization

Layer / File(s) Summary
Replace standard-library logger setup
backend/app/routes/face_clusters.py, backend/app/routes/models.py, backend/app/utils/images.py
The modules now use get_logger(__name__) from app.logging.setup_logging. Direct logging.getLogger usage and the unused standard-library logging imports were removed.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 96f82

This change standardizes logging in three backend modules so their messages use the project’s formatting and filtering without changing application logic or request behavior. No actionable merge-blocking risk remains after normal checks and review.

Suggested labels: Python

Suggested reviewers: rohan-pandeyy

Poem

A rabbit logs with colors bright
Custom formats guide every byte
Three modules join the trail
Standard loggers leave no tale
Hop, hop, consistent output prevails

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes address issue #1515 in all three affected modules. images.py no longer overwrites the project logger, and face_clusters.py and models.py now use get_logger.
Out of Scope Changes check ✅ Passed All changes are limited to logger imports and initialization in the three modules named in issue #1515. No unrelated code changes are present.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: replacing direct logging.getLogger usage with the project get_logger across backend modules.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gitcordapp

gitcordapp Bot commented Aug 30, 2026

Copy link
Copy Markdown

Link your account with Gitcord

Thanks for opening this PR, @Aditya30ag!

To receive Discord notifications and contributor tracking for this organization:

  1. Join Discord: https://discord.gg/hjUhu33uAn
  2. In Discord, run /link Aditya30ag
  3. Paste the verification code into your GitHub bio (or a public gist)
  4. Click Verify in Discord (or run /verify-link Aditya30ag)

Once linked, Gitcord can notify you about reviews, merges, and more.

Posted by Gitcord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request possible-duplicate Potential semantic duplicate (upstream comparison)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Inconsistent Logger Usage Across Backend Modules

1 participant