Skip to content

Refactor logger alias to optic and remove dead code#1336

Open
sanatmehrotra wants to merge 2 commits into
BlazeUp-AI:mainfrom
sanatmehrotra:main
Open

Refactor logger alias to optic and remove dead code#1336
sanatmehrotra wants to merge 2 commits into
BlazeUp-AI:mainfrom
sanatmehrotra:main

Conversation

@sanatmehrotra
Copy link
Copy Markdown

Purpose / Description

Two small housekeeping fixes in the server middleware layer:

  1. audit.py — The Loguru import used the bare logger name instead of the
    project-wide optic alias mandated by AGENTS.md. All 40+ other files in the
    codebase already use from loguru import logger as optic; this was the last
    outlier, making grep/search across the codebase inconsistent.

  2. main.py — A bare pass statement appeared immediately before an
    optic.warning(...) call in the same block. This implied the block was a
    silent no-op when it actually emits a warning, making the control flow
    misleading to readers. Removing pass restores clear intent.

Fixes

  • No open issue — pure code-quality / consistency cleanup.

Approach

  • audit.py: Changed from loguru import loggerfrom loguru import logger as optic
    and updated all call sites in the file from logger.*optic.*. No behaviour change.

  • main.py: Deleted the dead pass statement. The warning log and any
    subsequent logic in the block are unaffected.

How Has This Been Tested?

  • Existing test suite (make test) passes without modification — no logic was
    changed, only naming and dead-code removal.
  • Manually verified that optic.warning(...) still fires as expected by
    reading the surrounding control flow.
  • make lint (ruff check) passes cleanly on both files.

Learning (optional)

  • AGENTS.md § Optic (dev logging): "Import: from loguru import logger as optic" —
    the alias is intentional so log calls are grep-distinguishable from third-party
    libraries that also use logger.

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (N/A — no UI changes)

Aligns with project-wide convention from AGENTS.md.
Every other file uses rom loguru import logger as optic.
A bare pass before a logging statement implied silent swallowing.
The warning is now unambiguously the first action in the block.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jun 2, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added new contributor Pull request from a first-time contributor server Pull request touches server code labels Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new contributor Pull request from a first-time contributor server Pull request touches server code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants