ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PsrLogMessageProcessor.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\Processor;
13
15
24{
29 public function __invoke(array $record)
30 {
31 if (false === strpos($record['message'], '{')) {
32 return $record;
33 }
34
35 $replacements = array();
36 foreach ($record['context'] as $key => $val) {
37 if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) {
38 $replacements['{'.$key.'}'] = $val;
39 } elseif (is_object($val)) {
40 $replacements['{'.$key.'}'] = '[object '.Utils::getClass($val).']';
41 } else {
42 $replacements['{'.$key.'}'] = '['.gettype($val).']';
43 }
44 }
45
46 $record['message'] = strtr($record['message'], $replacements);
47
48 return $record;
49 }
50}
An exception for terminatinating execution or to throw for unit testing.
Processes a record's message according to PSR-3 rules.
$key
Definition: croninfo.php:18
An optional interface to allow labelling Monolog processors.