Refactor logger alias to optic and remove dead code#1336
Open
sanatmehrotra wants to merge 2 commits into
Open
Conversation
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.
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.
Purpose / Description
Two small housekeeping fixes in the server middleware layer:
audit.py— The Loguru import used the bareloggername instead of theproject-wide
opticalias mandated byAGENTS.md. All 40+ other files in thecodebase already use
from loguru import logger as optic; this was the lastoutlier, making grep/search across the codebase inconsistent.
main.py— A barepassstatement appeared immediately before anoptic.warning(...)call in the same block. This implied the block was asilent no-op when it actually emits a warning, making the control flow
misleading to readers. Removing
passrestores clear intent.Fixes
Approach
audit.py: Changedfrom loguru import logger→from loguru import logger as opticand updated all call sites in the file from
logger.*→optic.*. No behaviour change.main.py: Deleted the deadpassstatement. The warning log and anysubsequent logic in the block are unaffected.
How Has This Been Tested?
make test) passes without modification — no logic waschanged, only naming and dead-code removal.
optic.warning(...)still fires as expected byreading 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