1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 12:47:39 +02:00

Merge pull request #410 from harrytruong/master

PsrLogMessageProcessor updated to add valid string conversion conditions
This commit is contained in:
Jordi Boggiano
2014-09-10 16:26:00 +01:00

View File

@@ -32,7 +32,11 @@ class PsrLogMessageProcessor
$replacements = array();
foreach ($record['context'] as $key => $val) {
$replacements['{'.$key.'}'] = $val;
if (is_null($val) ||
is_scalar($val) ||
(is_object($val) && method_exists($val, "__toString"))) {
$replacements['{'.$key.'}'] = $val;
}
}
$record['message'] = strtr($record['message'], $replacements);