Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/.github export-ignore
/tests export-ignore
/.php-cs-fixer.php export-ignore
/.pmd-ruleset.xml export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml export-ignore
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.0.1]

### Fixed

- Per-processor `channels`/`handlers` routing no longer inherits global defaults when the processor defines its own routing. Previously, a processor with only `handlers` configured would also inherit global `channels`, causing an "cannot target both channels and handlers" error.

## [3.0.0]

### Breaking Changes
Expand Down
12 changes: 10 additions & 2 deletions src/DependencyInjection/ProcessorLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,16 @@ private function resolveUserProvider(array $processorConfig): Definition|Referen
*/
private function configureMonologProcessor(array $config, array $configOverride, Definition $processor, int $priority = 0): void
{
$channels = !empty($configOverride['channels']) ? $configOverride['channels'] : $config['monolog']['channels'];
$handlers = !empty($configOverride['handlers']) ? $configOverride['handlers'] : $config['monolog']['handlers'];
$processorHasChannels = !empty($configOverride['channels']);
$processorHasHandlers = !empty($configOverride['handlers']);

if ($processorHasChannels || $processorHasHandlers) {
$channels = $configOverride['channels'];
$handlers = $configOverride['handlers'];
} else {
$channels = $config['monolog']['channels'];
$handlers = $config['monolog']['handlers'];
}

if (!empty($channels) && !empty($handlers)) {
throw new InvalidConfigurationException('ecs_logging: a processor cannot target both channels and handlers simultaneously. Configure one or the other.');
Expand Down
Loading