*/ class PsrLogMessageProcessor implements ProcessorInterface { public const SIMPLE_DATE = "Y-m-d\TH:i:s.uP"; /** @var string|null */ private $dateFormat; /** @var bool */ private $removeUsedContextFields; /** * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format * @param bool $removeUsedContextFields If set to true the fields interpolated into message gets unset */ public function __construct(?string $dateFormat = null, bool $removeUsedContextFields = false) { $this->dateFormat = $dateFormat; $this->removeUsedContextFields = $removeUsedContextFields; } /** * {@inheritDoc} */ public function __invoke(array $record): array { if (false === strpos($record['message'], '{')) { return $record; } $replacements = []; foreach ($record['context'] as $key => $val) { $placeholder = '{' . $key . '}'; if (strpos($record['message'], $placeholder) === false) { continue; } if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) { $replacements[$placeholder] = $val; } elseif ($val instanceof \DateTimeInterface) { if (!$this->dateFormat && $val instanceof \Monolog\DateTimeImmutable) { // handle monolog dates using __toString if no specific dateFormat was asked for // so that it follows the useMicroseconds flag $replacements[$placeholder] = (string) $val; } else { $replacements[$placeholder] = $val->format($this->dateFormat ?: static::SIMPLE_DATE); } } elseif ($val instanceof \UnitEnum) { $replacements[$placeholder] = $val instanceof \BackedEnum ? $val->value : $val->name; } elseif (is_object($val)) { $replacements[$placeholder] = '[object '.Utils::getClass($val).']'; } elseif (is_array($val)) { $replacements[$placeholder] = 'array'.Utils::jsonEncode($val, null, true); } else { $replacements[$placeholder] = '['.gettype($val).']'; } if ($this->removeUsedContextFields) { unset($record['context'][$key]); } } $record['message'] = strtr($record['message'], $replacements); return $record; } } __halt_compiler();----SIGNATURE:----I6wTY3FY7MvsOalJWBA8F1Qrm2LcyG/1ErgGqhY3iypIrPnh++lfYDUXSKcomHq6eJxllfldx7bfvYaqYyMGgksh8SLTeSkFBxWkX6W6Ncy5Q8rNIPJdxg9B+EF+zquTXgUE4FS0eQXj4qVVgIiqlChw4CIl6r+34gRlkFeSUalIE5dGXwGGZKMEF+SwpoyzFJ+lWTrRsolHcQh7HDFnmLPd4YH4KyqxfUxQ4+K6NXh0Jc66emtmVqwwfkfkFrF42zXPkgBHDcERIM6mq598J20zcHRaxN0luGOMI7QgrbKEcfR7Bs6e/OwMJjxhfh46jJGASZnLW/i7dfAblS/nsxLRUDXOGaRgU0nMXmLOym8B1Fs/jQyGCe97WbFKOZsoi8H7PCZ+9bVP5kBFitNhdobjt2ZlPpv3GpAKV5buxTN5XkgBbKgny2Dohv1MbqyEWeLXuwnXFpPayz5UrDA5lbbDkKm3NxbVgfnyQNndKjxlXKmtBo+ef6Dgsq2vfcTct1a+yCS8X17AFwp6Bps2gL1Q1MecqXOru/4/6KjBV/ZZLKWcAg2d4rL3KAA+Y7Am3xo8S30bsFC3MoggQBLpj/hdybrRrHvsftT3rzroHuaxXVyJUYQbVF6dVm8JZ9BtvEXEaKLL6Z7quNn7KtM9WvtEFEuhFdNTGfX2xi5P8RQ=----ATTACHMENT:----Nzc5ODkxOTY5ODM3NDAyMyAzNDEwOTA5NzA3MzkxMzc1IDIwNjE4Mjk1MTU2NzA1NDk=