mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 16:15:49 +03:00
[GH-ISSUE #1185] Maybe LineFormatter shouldn't replace line breaks in the context values #487
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#487
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 @nesk on GitHub (Aug 6, 2018).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1185
I need to log some ASCII tables, like this one:
The default configuration of the
LineFormatteris not really suitable to easily read these tables, so I've allowed inline line breaks, here's an example:If you run this code, you will get the following output:
However, I don't think it's relevant to replace
\nand\roccurences in the log string with real line breaks because it is no longer a valid JSON object (and it's hard to distinguish the message from the context), here's what I was expecting instead:This condition seems to be responsible of the additional line breaks:
github.com/Seldaek/monolog@334b8d8783/src/Monolog/Formatter/LineFormatter.php (L159-L161)What do you think? Is this the wanted behavior?
@nesk commented on GitHub (Aug 10, 2018):
Note that I'm just asking if this would be something accepted in a PR. I'm willing to write the PR by myself. 🙂
@Seldaek commented on GitHub (Nov 4, 2018):
I think maybe we could add another option in monolog 2 so that you can allow real line breaks, or optionally expand line breaks that have been inlined in json.
The way I use this, I never need the json to be actual json, and I don't wanna bother putting placeholders to get the expanded value in the message.. I just want to get whatever is in the context including line breaks.
@HenkPoley commented on GitHub (May 13, 2019):
This also bites when parts of the path on Windows starts with an 'n' or an 'r' and you throw an exception. See the linked issue above.