mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-27 00:25:50 +03:00
[GH-ISSUE #889] Formatter Syntax (Documentation Not Available) #349
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#349
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 @lloy0076 on GitHub (Nov 23, 2016).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/889
There's no obvious cheat sheet for what substitutions one can make for the Formatters (I'm specifically thinking of the "LineFormatter". I've tried to follow the code backwards via inheritance and can see that it extends the NormalizeFormatter but its not clear to me how or where the substitutions are made.
If it were, I'd have proposed a Pull Request for such documentation.
If it's not really obvious, how might we better document what one can put into the format string for the LineFormatter and possibly other relevant loggers?
I'm using the latest version of Monolog from composer (composer update monolog/monolog) and looking in the latest MASTER on this GitHub.
(I'd add this to the documentation label but I'm not sure how to do that either :()
@Seldaek commented on GitHub (Nov 25, 2016):
You mean the substitutions in the line format like %foo% in https://github.com/Seldaek/monolog/blob/master/src/Monolog/Formatter/LineFormatter.php#L24 right?
It's done in format() https://github.com/Seldaek/monolog/blob/master/src/Monolog/Formatter/LineFormatter.php#L71-L107 and basically any field of the $record array is usable for substitution.. If it's a complex data type it's stringified using the NormalizerFormatter code, but the details of that shouldn't really matter to most users. What would be good is to document all fields of $record, and then extra and context are also available via
%extra.foo%for example to access subkey foo. If you'd like to work on a PR for that that'd be great, but not sure where to fit this best.@lloy0076 commented on GitHub (Nov 26, 2016):
Ah, now that you've pointed it out I can see where the substitutes happen - I'd be happy to work on a PR which I'll place "somewhere" with the acknowledgment that I mightn't get it in the "right" place at first :)
@Seldaek commented on GitHub (Nov 26, 2016):
No worries, moving text is a lot easier than writing it ;)