Skip to content
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

Add priority field to processor tags #485

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add comment
  • Loading branch information
HypeMC committed Aug 6, 2024
commit 6f6130ab066b48628b48e0442cb6f9fd21ba3d0e
1 change: 1 addition & 0 deletions DependencyInjection/Compiler/AddProcessorsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function process(ContainerBuilder $container)
return;
}

// array_reverse is used because ProcessableHandlerTrait::pushProcessor prepends processors to the beginning of the stack
foreach (array_reverse($this->findAndSortTaggedServices('monolog.processor', $container)) as $reference) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps comment why array_reverse is used ?
otherwise its smart :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does this behave when we have multiple tags (for instance when registering the processor in specific channels or in specific handlers ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stof Good catch, it didn't work. I've managed to fix it. Please let me know what you think of the fix. It's probably easiest to review it with whitespace changes ignored.

$tags = $container->getDefinition((string) $reference)->getTag('monolog.processor');

Expand Down
Loading