Fix #146: Move Target configuration to constructor parameters and deprecate the corresponding setters#146
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #146 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 163 165 +2
===========================================
Files 11 11
Lines 449 454 +5
===========================================
+ Hits 449 454 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
📝 WalkthroughWalkthroughThis PR enables immutable initialization of logging targets by moving configuration from setter methods to constructor parameters. ChangesConstructor-based Target configuration
🎯 3 (Moderate) | ⏱️ ~25 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/guide/ru/README.md`:
- Around line 123-127: Remove the blank line(s) inside the blockquote so the
quoted lines about deprecated setters (the lines mentioning setExportInterval(),
setCategories(), setExcept(), setLevels(), setFormat(), setPrefix(),
setTimestampFormat(), setEnabled() and the note about export on shutdown) form a
single contiguous blockquote; edit the README.md blockquote so there are no
empty lines between the quoted lines (this will satisfy markdownlint
MD028/no-blanks-blockquote).
In `@README.md`:
- Around line 139-143: Remove the blank line inside the blockquote so
consecutive quoted lines are contiguous; specifically edit the block containing
the deprecation note for setExportInterval() and the related setters
(setCategories(), setExcept(), setLevels(), setFormat(), setPrefix(),
setTimestampFormat(), setEnabled()) and the following "Note: All message
flushing..." line so there is no empty line between those blockquote lines,
keeping each quoted line on its own line but without an intervening blank line.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bd9d39a9-b2b9-480a-829c-d9f141a4f07d
📒 Files selected for processing (9)
CHANGELOG.mdREADME.mddocs/guide/ru/README.mdsrc/Message/Formatter.phpsrc/PsrTarget.phpsrc/StreamTarget.phpsrc/Target.phptests/TargetTest.phptests/TestAsset/DummyTarget.php
Target configuration to constructor parameters and deprecate the corresponding setters
|
👍 |
What does this PR do?
Follow-up to #140. Move
Target's configuration setters to constructor parameters and mark the setters as deprecated.New constructor parameters on
Target, forwarded byStreamTargetandPsrTarget:$levels(already present)$categories,$exceptCategories- category filters$format,$prefix,$timestampFormat- formatting$exportInterval- export batching$enabled- enable/disable stateDeprecated (to be removed in 3.0), each replaced by the matching constructor parameter:
setCategories(),setExcept(),setLevels(),setFormat(),setPrefix(),setExportInterval(),setTimestampFormat(),setEnabled().Use cases
No BC break: the setters keep working (deprecated only), and every constructor parameter is optional with the current default.
The internal
Formattergets the matching constructor parameters too. Its setters stay (not deprecated) because the deprecatedTargetsetters delegate to them, and that delegation has to keep working until they are all removed in 3.0.Summary by CodeRabbit
New Features
Documentation
Tests