[GH-ISSUE #672] Improve extensability of Monolog/Formatter/HtmlFormatter.php #249

Closed
opened 2026-03-04 02:13:28 +03:00 by kerem · 1 comment
Owner

Originally created by @azine on GitHub (Oct 23, 2015).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/672

Hi,

I use the HtmlFormatter to send Emails of error-messages to my inbox. But I wanted to add some custom stuff in the html => overwrite the "format" function.

I saw that the "private" modifiers of the functions "addRow" and "addTitle" and of the field "$logLevels" force anyone who wants to change/overwrite the "format" function to also implement these functions and the array.

Changing the modifiers to "protected" would remove this "duplicate code".

Please consider changing the modifiers to "protected" for:

  • \Monolog\Formatter\HtmlFormatter::$logLevels
  • \Monolog\Formatter\HtmlFormatter::addTitle
  • \Monolog\Formatter\HtmlFormatter::addTitle

Thanx for your bundle!

Best regards,
Dominik

Originally created by @azine on GitHub (Oct 23, 2015). Original GitHub issue: https://github.com/Seldaek/monolog/issues/672 Hi, I use the HtmlFormatter to send Emails of error-messages to my inbox. But I wanted to add some custom stuff in the html => overwrite the "format" function. I saw that the "private" modifiers of the functions "addRow" and "addTitle" and of the field "$logLevels" force anyone who wants to change/overwrite the "format" function to also implement these functions and the array. Changing the modifiers to "protected" would remove this "duplicate code". Please consider changing the modifiers to "protected" for: - \Monolog\Formatter\HtmlFormatter::$logLevels - \Monolog\Formatter\HtmlFormatter::addTitle - \Monolog\Formatter\HtmlFormatter::addTitle Thanx for your bundle! Best regards, Dominik
kerem closed this issue 2026-03-04 02:13:28 +03:00
Author
Owner

@Seldaek commented on GitHub (Oct 24, 2015):

I agree for logLevels, and changed that in github.com/Seldaek/monolog@3d779cc34d - but for addTitle/addRow IMO they are really implementation specific and if you want to change the look of the email you'd better implement your whole layout. Otherwise we can't really change the way the email looks anymore without keeping the addRow/addTitle concept which is very dependent on the current style and layout of the email.

Another approach would be to override format(), and first call parent::format() and then modify/append things to the result before returning it.

<!-- gh-comment-id:150803648 --> @Seldaek commented on GitHub (Oct 24, 2015): I agree for logLevels, and changed that in https://github.com/Seldaek/monolog/commit/3d779cc34d7cec9190eb5d30f794d97e01e3abe2 - but for addTitle/addRow IMO they are really implementation specific and if you want to change the look of the email you'd better implement your whole layout. Otherwise we can't really change the way the email looks anymore without keeping the addRow/addTitle concept which is very dependent on the current style and layout of the email. Another approach would be to override format(), and first call parent::format() and then modify/append things to the result before returning it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#249
No description provided.