mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-27 08:35:53 +03:00
[GH-ISSUE #1865] Support more flexible normalizer #797
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#797
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @torreytsui on GitHub (Jan 3, 2024).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1865
Many times, I encountered use cases around custom normalization.
To name a few:
I understand that we can write our Processor or a Formatter or implement the JsonSerializable to achieve that.
But I can also see that the "nomalization" logic was the main customisation we really needed in those use cases.
The
NormalizerFormatterclass is great and I don't want to duplicate its logic.What do you think if we make it more flexible and customizable?
Suggestion 1: introduce protected normalizeObject() method
Suggestion 2: introduce normalizer components
Or other suggestions? or not really worth it?
@cesarreyes3 commented on GitHub (Mar 20, 2024):
Would this help me if I want to customize the
file:lineformat?github.com/Seldaek/monolog@479c936d2c/src/Monolog/Formatter/LineFormatter.php (L261)@Seldaek commented on GitHub (Apr 12, 2024):
IMO you can already extend and override
normalize(), handling any special types you want to handle, then defer to the parent method for the rest. I don't really see what a more complicated system would bring there given this isn't a very common case I think.@cobbles commented on GitHub (Nov 26, 2025):
This may be a separate request but I thought I would ask on this thread in case it helps give context. We have a use case where we would like to limit the length of of the stack trace to a max length so that large logs to stdout do not get truncated and resulting in invalid json.
Before I extend
NormaliserFormatteris this a feature that would be desired?If so I am happy to raise the Issue/PR for review
@Seldaek commented on GitHub (Dec 30, 2025):
@cobbles IMO a max stack trace length would be ok as a standard option on NormalizerFormatter that can be changed via a setter, if you want to send a PR for that
@Seldaek commented on GitHub (Dec 30, 2025):
But otherwise closing this issue as I don't think there's anything to address here.