ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ScalarFormatter.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of the Monolog package.
5 *
6 * (c) Jordi Boggiano <j.boggiano@seld.be>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Monolog\Formatter;
13
21{
25 public function format(array $record)
26 {
27 foreach ($record as $key => $value) {
28 $record[$key] = $this->normalizeValue($value);
29 }
30
31 return $record;
32 }
33
38 protected function normalizeValue($value)
39 {
40 $normalized = $this->normalize($value);
41
42 if (is_array($normalized) || is_object($normalized)) {
43 return $this->toJson($normalized, true);
44 }
45
46 return $normalized;
47 }
48}
Normalizes incoming records to remove objects/resources so it's easier to dump to various targets.
Formats data into an associative array of scalar values.
format(array $record)
{{Formats a log record.mixed The formatted record}}