-
-
Notifications
You must be signed in to change notification settings - Fork 232
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
base: master
Are you sure you want to change the base?
Conversation
public function process(ContainerBuilder $container) | ||
{ | ||
if (!$container->hasDefinition('monolog.logger')) { | ||
return; | ||
} | ||
|
||
foreach ($container->findTaggedServiceIds('monolog.processor') as $id => $tags) { | ||
foreach (array_reverse($this->findAndSortTaggedServices('monolog.processor', $container)) as $reference) { |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, done
So that the order in which the processors are used by monolog can be determined.
public function process(ContainerBuilder $container) | ||
{ | ||
if (!$container->hasDefinition('monolog.logger')) { | ||
return; | ||
} | ||
|
||
foreach ($container->findTaggedServiceIds('monolog.processor') as $id => $tags) { | ||
// 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) { |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
Continuation of #455.