Important: #94315 - Use proper PSR-3 logging messages and context
See forge#94315
Description
The v11 Core is looking into proper PSR-3 Logging implementation again. When analyzing the current situation, we realized many Core logging calls were using messages that violated the PSR-3 placeholder specification.
The v11 Core fixed all places, but it's likely extensions have this issue, too. Extension developers should have a look at their logger calls and adapt them if necessary.
Typical call before:
$this->logger->alert(
'Password reset requested for email "' .
$emailAddress . '" . but was requested too many times.'
);
Correct call:
$this->logger->alert(
'Password reset requested for email {email} but was requested too many times.',
['email' => $emailAddress]
);
First argument is message
, second (optional) argument is context
.
A message can use {placeholders}
.
All Core provided log writers will substitute placeholders in the message with data from the context array, if a context array key with same name exists.