-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding JsonFormatter Support to Monolog Handler #268
base: main
Are you sure you want to change the base?
Conversation
Thanks for opening your first pull request! If you haven't yet signed our Contributor License Agreement (CLA), then please do so that we can accept your contribution. A link should appear shortly in this PR if you have not already signed one. |
It's not a typo, but it could be a bug, depending on which Monolog formatter you are using. A formatter must be used: https://github.com/Seldaek/monolog/blob/main/src/Monolog/Handler/FormattableHandlerTrait.php#L42 and we configure |
That's correct, we're using the
I can confirm that with the |
Okay I've tested the following formatters
The others listed here aren't relevant as far as I can tell. The most recent commit will decode the JSON before populating the |
@@ -45,7 +45,9 @@ protected function getDefaultFormatter(): FormatterInterface | |||
*/ | |||
protected function write($record): void | |||
{ | |||
$formatted = $record['formatted']; | |||
$formatted = ($this->getFormatter() instanceof JsonFormatter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't there either be an use
for JsonFormatter
or fully qualified name?
@Spittal hi, sorry for the slow response. The build is failing on this PR, and it looks like the issue that Ago mentioned above |
ping @Spittal |
In the current iteration
$record['formatted']
is a string, which is then used later used in an attempt to accessmessage
from. I can only imagine this was typo, or an oversight.I have tested locally and this works now.