1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-06 13:16:39 +02:00

Update NormalizerFormatter.php

Some objects implement magic __toString method
Allow to print this kind of objects in the logger
This commit is contained in:
Dmitrii Raev
2015-04-22 11:44:08 +03:00
parent 03fc68ca14
commit ff4d9176d0

View File

@@ -94,7 +94,11 @@ class NormalizerFormatter implements FormatterInterface
return $this->normalizeException($data);
}
return sprintf("[object] (%s: %s)", get_class($data), $this->toJson($data, true));
if (method_exists($data, '__toString')) {
return sprintf("[object] (%s: %s)", get_class($data), $data);
} else {
return sprintf("[object] (%s: %s)", get_class($data), $this->toJson($data, true));
}
}
if (is_resource($data)) {