75 public function format(array $record)
77 return $this->
toJson($this->
normalize($record),
true) . ($this->appendNewline ?
"\n" :
'');
85 switch ($this->batchMode) {
86 case static::BATCH_MODE_NEWLINES:
89 case static::BATCH_MODE_JSON:
126 $this->appendNewline =
false;
127 array_walk($records,
function (&$value,
$key) use ($instance) {
128 $value = $instance->format($value);
130 $this->appendNewline = $oldNewline;
132 return implode(
"\n", $records);
145 return 'Over 9 levels deep, aborting normalization';
148 if (is_array(
$data) ||
$data instanceof \Traversable) {
149 $normalized = array();
153 if ($count++ > 1000) {
154 $normalized[
'...'] =
'Over 1000 items ('.count(
$data).
' total), aborting normalization';
183 throw new \InvalidArgumentException(
'Exception/Throwable expected, got '.gettype($e).
' / '.
Utils::getClass($e));
188 'message' => $e->getMessage(),
189 'code' => $e->getCode(),
190 'file' => $e->getFile().
':'.$e->getLine(),
194 $trace = $e->getTrace();
195 foreach ($trace as $frame) {
196 if (isset($frame[
'file'])) {
197 $data[
'trace'][] = $frame[
'file'].
':'.$frame[
'line'];
198 } elseif (isset($frame[
'function']) && $frame[
'function'] ===
'{closure}') {
200 $data[
'trace'][] = $frame[
'function'];
208 if ($previous = $e->getPrevious()) {