mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-08 06:06:40 +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,8 +94,12 @@ class NormalizerFormatter implements FormatterInterface
|
|||||||
return $this->normalizeException($data);
|
return $this->normalizeException($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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));
|
return sprintf("[object] (%s: %s)", get_class($data), $this->toJson($data, true));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_resource($data)) {
|
if (is_resource($data)) {
|
||||||
return '[resource]';
|
return '[resource]';
|
||||||
|
Reference in New Issue
Block a user