Allow setting levels in Target constructor#55
Merged
Conversation
Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Allow setting levels in Target constructor
Allow setting levels in Target constructor
Dec 7, 2025
Member
|
@copilot add a line for CHANGELOG. |
Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Contributor
Author
There was a problem hiding this comment.
Pull request overview
This PR adds support for setting log levels directly in the SyslogTarget constructor, bringing it in line with the base Target class API from yiisoft/log#128. This allows developers to filter log levels at instantiation time rather than only through configuration.
Key changes:
- Added optional
$levelsparameter toSyslogTargetconstructor that passes to parent - Updated configuration examples to demonstrate the new levels parameter
- Added comprehensive test coverage for level filtering functionality
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/SyslogTarget.php | Added optional $levels parameter to constructor with proper documentation |
| tests/SyslogTargetTest.php | Added test case testConstructorWithLevels() to verify level filtering behavior |
| config/params.php | Added commented example showing how to configure levels in parameters |
| config/di.php | Updated DI configuration to support optional levels parameter with fallback |
| README.md | Enhanced documentation with $levels parameter description and usage example |
| CHANGELOG.md | Added entry documenting the new feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
vjik
requested changes
Dec 9, 2025
vjik
reviewed
Dec 9, 2025
Member
vjik
left a comment
There was a problem hiding this comment.
Version yiisoft/log in composer.json should be updated after yiisoft/log release.
Co-authored-by: Sergei Predvoditelev <sergei@predvoditelev.ru>
samdark
reviewed
Dec 11, 2025
Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Member
|
@copilot require yiisoft/log ^2.2 |
Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Contributor
Author
vjik
requested changes
Dec 13, 2025
Co-authored-by: Sergei Predvoditelev <sergei@predvoditelev.ru>
vjik
approved these changes
Dec 13, 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.
Adds
$levelsparameter toSyslogTargetconstructor to match the baseTargetclass API from yiisoft/log#128.Changes:
array $levels = []parameter to constructor, passed toparent::__construct()config/di.phpto support optional levels parameter with safe fallbackyiisoft/logrequirement to^2.2to ensure compatibility with the new constructor signatureUsage:
Backward compatible - defaults to empty array (all levels). Users can optionally configure levels in their own params configuration.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.