refactor(logger): optimize logger configuration structure#7563
Merged
limingxinleo merged 14 commits intohyperf:3.2from Nov 3, 2025
Merged
refactor(logger): optimize logger configuration structure#7563limingxinleo merged 14 commits intohyperf:3.2from
limingxinleo merged 14 commits intohyperf:3.2from
Conversation
There was a problem hiding this comment.
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.
Member
|
兼容老版 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
Member
Author
调整好了 |
huangdijia
commented
Nov 3, 2025
… in LoggerFactory
limingxinleo
approved these changes
Nov 3, 2025
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 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.