Spaces:
Sleeping
Sleeping
Commit History
-
Apply ruff formatting to Loguru migration files
ming +1: ClaudeAutomatic code formatting applied by ruff during pre-commit hook. These are cosmetic changes only (code style, no functional changes). Files formatted: - app/core/logging.py - tests/test_logging.py - tests/test_loguru_context.py - tests/test_loguru_integration.py - tests/test_loguru_setup.py 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>75fe59b -
Migrate logging from stdlib to Loguru for structured logging
ming +1: ClaudeThis migration replaces Python's standard logging module with Loguru, providing structured logging with automatic request ID propagation, environment-aware formatting, and improved developer experience. ## Changes ### Core Implementation - app/core/logging.py: Complete rewrite (224 lines) - Environment-aware formatting (JSON for prod, colored text for dev) - Context variables for automatic request ID propagation - Custom JSON serializer with structured fields - Backward-compatible get_logger() and RequestLogger APIs - app/core/middleware.py: - Integrated context var (request_id_var) for request ID injection - Automatic propagation eliminates manual parameter passing - app/core/config.py: - Added LOG_FORMAT setting (json/text/auto) with validator - Auto-detection based on HF_SPACE_ROOT_PATH environment - requirements.txt: - Added loguru>=0.7.0 dependency ### Testing (44 tests, 100% passing) - tests/test_loguru_context.py: Context variable propagation (7 tests) - …7ab470d