Add comprehensive logging throughout the application#7
Merged
Conversation
- New logging_config.py: configures root logger from LOG_LEVEL env var - main.py: HTTP request timing middleware logs method/path/status/ms - recommend.py: logs request params, top score, result count; wraps catalog load and scoring in try/except with HTTPException on failure - engine.py: DEBUG-level per-item score traces and ranked list summary - catalog.py: logs catalog file path and item count on load - main.js: structured console logger (log.info/debug/error) with per-request timing; verbose debug output gated on curio-debug=true in localStorage https://claude.ai/code/session_016AW7kKjJdbSnspDi1fJ3q7
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.
Summary
This PR adds structured logging across the backend and frontend to improve observability and debugging capabilities. A new logging configuration module centralizes log setup, and logging statements are added at key points in the recommendation pipeline and HTTP request handling.
Key Changes
Backend Logging Infrastructure:
app/logging_config.pywith centralized logging configuration that respectsLOG_LEVELenvironment variable (defaults to INFO)API & Request Logging:
main.pyto log all requests with method, path, status code, and duration/recommendendpoint with detailed logging:Scoring Engine Logging:
score_item()to show per-item scoring detailsrank_recommendations()to show ranking results and top scoresCatalog Service Logging:
Frontend Logging:
curio-debuglocalStorage flag to enable/disable debug outputImplementation Details
__name__for proper module identification[Curio]or[Curio:debug]for easy identificationexc_info=Truefor full stack tracestime.perf_counter()for high-resolution measurementshttps://claude.ai/code/session_016AW7kKjJdbSnspDi1fJ3q7