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

Merge branch '1.x'

This commit is contained in:
Jordi Boggiano
2016-11-26 01:23:57 +01:00
11 changed files with 1010 additions and 171 deletions

View File

@@ -79,17 +79,13 @@ class NormalizerFormatter implements FormatterInterface
return $data;
}
if (is_array($data) || $data instanceof \Traversable) {
if (is_array($data)) {
$normalized = [];
$count = 1;
if ($data instanceof \Generator && !$data->valid()) {
return array('...' => 'Generator is already consumed, aborting');
}
foreach ($data as $key => $value) {
if ($count++ >= 1000) {
$normalized['...'] = 'Over 1000 items ('.($data instanceof \Generator ? 'generator function' : count($data).' total').'), aborting normalization';
$normalized['...'] = 'Over 1000 items ('.count($data).' total), aborting normalization';
break;
}
$normalized[$key] = $this->normalize($value, $depth + 1);