-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
refactor(logger): optimize logger configuration structure #7563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the logger configuration from a flat group-based structure to a more organized channel-based approach inspired by Laravel's logging system. The changes introduce a default channel concept and provide multiple predefined channel configurations for common logging scenarios.
Key Changes:
- Introduced channel-based configuration structure with
defaultandchannelskeys - Updated
LoggerFactoryAPI to usechannelparameter instead ofgroup - Added predefined channel configurations (stack, single, daily, stderr, syslog, null)
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/logger/src/LoggerFactory.php | Updated factory methods to use channel-based lookups and improved type hints |
| src/logger/publish/logger.php | Restructured configuration to channel-based format with multiple predefined channels |
| src/logger/tests/LoggerFactoryTest.php | Updated test configuration structure and parameter names to reflect channel-based approach |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
兼容老版 logger 结构 default 为 string 使用新版, |
- Restructured logger configuration to use channel-based approach similar to Laravel - Changed configuration structure from group-based to channel-based for better clarity - Added multiple predefined channels: stack, single, daily, stderr, syslog, and null - Updated LoggerFactory to use 'channel' parameter instead of 'group' parameter - Added support for default channel configuration via LOG_CHANNEL environment variable - Added support for stack channel configuration via LOG_STACK environment variable - Improved type hints in LoggerFactory methods - Updated tests to reflect the new channel-based approach - Maintained backward compatibility with existing configurations
…slog handler configuration
67c75a2 to
73032b9
Compare
调整好了 |
… in LoggerFactory
Summary
This PR refactors the logger configuration structure to use a channel-based approach similar to Laravel's logging system, providing better clarity and flexibility.
Changes
LOG_CHANNELenvironment variablestack: Combines multiple channels (configurable viaLOG_STACKenv var)single: Single log filedaily: Rotating daily log filesstderr: Output to stderrsyslog: System log handlernull: Null handler for disabling logsLoggerFactorymethods to usechannelparameter instead ofgroupTest Plan
channelparameterBackward Compatibility
The changes maintain backward compatibility with existing configurations while providing a more intuitive structure for new implementations.