feat: Support Customizable Logging Format in Infinity#644
feat: Support Customizable Logging Format in Infinity#644shalousun wants to merge 1 commit intomichaelfeil:mainfrom
Conversation
There was a problem hiding this comment.
Greptile Summary
This PR introduces customizable logging format support to the Infinity embedding library, allowing users to configure logging behavior through environment variables. The changes span three key files:
Core logging configuration (log_handler.py): Adds two new environment variables - INFINITY_DISABLE_RICH_HANDLER to optionally disable Rich console formatting and INFINITY_LOG_FORMAT to specify custom log message formats. The implementation restructures handler initialization to conditionally use Rich formatting, falling back to standard StreamHandler when Rich is disabled or unavailable.
CLI server integration (cli.py): Introduces a new set_uvicorn_logging_configs() function that enables customization of Uvicorn server log formats through three additional environment variables (INFINITY_UVICORN_DEFAULT_FORMAT, INFINITY_UVICORN_ACCESS_FORMAT, INFINITY_UVICORN_DATE_FORMAT). This function modifies the global Uvicorn logging configuration and is called before server startup.
Environment management (env.py): Extends the environment configuration system with five new @cached_property methods that provide centralized access to all the new logging-related environment variables with sensible defaults.
These changes maintain backward compatibility by preserving existing default behavior while providing opt-in customization capabilities. This addresses production deployment needs where logs must integrate with specific monitoring systems or follow organizational standards.
Confidence score: 3/5
- This PR has implementation issues that could cause problems in production environments
- Score lowered due to inconsistent environment variable handling between files and formatting problems in env.py
- Pay close attention to libs/infinity_emb/infinity_emb/env.py for malformed default value and libs/infinity_emb/infinity_emb/cli.py for hardcoded environment variable names
3 files reviewed, 2 comments
50239f0 to
ef5fda5
Compare
Related Issue
closes #640
Checklist
Additional Notes
Add any other context about the PR here.