ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Monolog\Processor\PsrLogMessageProcessor Class Reference

Processes a record's message according to PSR-3 rules. More...

+ Inheritance diagram for Monolog\Processor\PsrLogMessageProcessor:
+ Collaboration diagram for Monolog\Processor\PsrLogMessageProcessor:

Public Member Functions

 __invoke (array $record)
 

Detailed Description

Processes a record's message according to PSR-3 rules.

It replaces {foo} with the value from $context['foo']

Author
Jordi Boggiano j.bog.nosp@m.gian.nosp@m.o@sel.nosp@m.d.be

Definition at line 23 of file PsrLogMessageProcessor.php.

Member Function Documentation

◆ __invoke()

Monolog\Processor\PsrLogMessageProcessor::__invoke ( array  $record)
Parameters
array$record
Returns
array

Implements Monolog\Processor\ProcessorInterface.

Definition at line 29 of file PsrLogMessageProcessor.php.

References $key.

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  }
$key
Definition: croninfo.php:18

The documentation for this class was generated from the following file: