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:
@@ -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)) {
|
||||
|
Reference in New Issue
Block a user