1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-21 08:36:33 +02:00

Support objects/arrays/resources a bit better, refs #410

This commit is contained in:
Jordi Boggiano
2014-09-10 16:41:01 +01:00
parent 2351b65d49
commit b3f039339d
2 changed files with 50 additions and 3 deletions

View File

@@ -32,10 +32,12 @@ class PsrLogMessageProcessor
$replacements = array();
foreach ($record['context'] as $key => $val) {
if (is_null($val) ||
is_scalar($val) ||
(is_object($val) && method_exists($val, "__toString"))) {
if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) {
$replacements['{'.$key.'}'] = $val;
} elseif (is_object($val)) {
$replacements['{'.$key.'}'] = '[object '.get_class($val).']';
} else {
$replacements['{'.$key.'}'] = '['.gettype($val).']';
}
}