Seldaek / monolog

Sends your logs to files, sockets, inboxes, databases and various web services
https://seldaek.github.io/monolog/
MIT License
21.05k stars 1.9k forks source link

User definable duplication for DeduplicationHandler #1878

Closed cracksalad closed 7 months ago

cracksalad commented 7 months ago

The DeduplicationHandler defines duplication as multiple records having the same message and level. In general this is probably the right way to do it, but in specific cases it might be required to include some other attributes like context, extra or channel in this condition as well. Therefore you would want to overwrite the DeduplicationHandler::isDuplicate() method to define duplication by yourself. This is currently impossible due to the method being private. That is why I suggest to change the visibility to protected. Additionally it would probably be desirable to move the duplicationStore stuff to another method and pass the $store variable to the isDuplicate() method. Just to make it a bit simpler to overwrite the method.

Of course one could also (as a workaround) add the additional attributes from say context to the message itself, but that would change the outcome in your logfiles or what have you.

If you approve this suggestion, I am willing to help and perform those changes by myself and create a PR afterwards. Just let me know!