mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-25 23:55:56 +03:00
[GH-ISSUE #1788] LogRecord->with does not transfers "formatted" value #757
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#757
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 @Justinas-Jurciukonis on GitHub (Jan 17, 2023).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1788
Monolog version 3.2.0
When
PsrLogMessageProcessorprocesses message, it returns new instance ofLogRecordusing codeand inside
LogRecord->withthere is missingformattedkey to be copied over, so if any previous processor set any information insideLogRecord->formattedit will be lost.Seems like same issue with
toArray@Seldaek commented on GitHub (Feb 4, 2023):
Normally formatting happens after processing, so this should never be a problem. Have you experienced an actual issue?
@Justinas-Jurciukonis commented on GitHub (Feb 6, 2023):
@Seldaek Yes, since we use custom logic to format all records.
Basically logic was as follows:
formattedpropertyformattedto the place where it needs to beformatted. Means formatters only responsible for final output, but not structure of log itselfWith this approach formatters does not care about structure, just how format
LogRecordto string. Processors are responsible for it's own parts ofLogRecord->formattedprocessing.E.g. Adding information about current user can come from 3 different processors and it merges under key
LogRecord->formatted->user@stof commented on GitHub (Feb 6, 2023):
This looks like the use case for
LogRecord->extrainstead@Seldaek commented on GitHub (Feb 7, 2023):
Right, exactly my thinking @stof - sounds to me like these processors should all record stuff in extra as they are meant to, and then the final formatter can use the info in context/extra to generate the final formatted record.