* * @phpstan-import-type Record from \Monolog\Logger */ class ElasticaFormatter extends NormalizerFormatter { /** @var string Elastic search index name */ protected $index; /** @var ?string Elastic search document type */ protected $type; /** * @param string $index Elastic Search index name * @param ?string $type Elastic Search document type, deprecated as of Elastica 7 */ public function __construct(string $index, ?string $type) { // elasticsearch requires a ISO 8601 format date with optional millisecond precision. parent::__construct('Y-m-d\TH:i:s.uP'); $this->index = $index; $this->type = $type; } /** * {@inheritDoc} */ public function format(array $record) { $record = parent::format($record); return $this->getDocument($record); } public function getIndex(): string { return $this->index; } /** * @deprecated since Elastica 7 type has no effect */ public function getType(): string { /** @phpstan-ignore-next-line */ return $this->type; } /** * Convert a log message into an Elastica Document * * @phpstan-param Record $record */ protected function getDocument(array $record): Document { $document = new Document(); $document->setData($record); if (method_exists($document, 'setType')) { /** @phpstan-ignore-next-line */ $document->setType($this->type); } $document->setIndex($this->index); return $document; } } __halt_compiler();----SIGNATURE:----tasWnwyrsEJl7G84mVOvM5jEQXGFKCQWCW0e5KBwPtbEckLYb60alOcUG+kjLHLn1NTy5VJBM//DV3HcbL0NbFC0KTUTyqVw0JVxNuofg5ArpzaWKjrTPUbM5B82+C8Ao14XsoFxfNuPr22B4Oh3KooAcpFOC4ImBCibTrwQzssyGzm0SzLtuURHQ9tzwk8f5ECXhVXDhna2osW5dKCq1ztL1FYbdOYEPRlgJ1pT59K8/obShVGw6TpEJL+W32zW9mbjEkzVD1ZdonBsP+RahHLfDPAcTblUXpE3dT+VwGOvTY5Kfs4fXMudvB+08n++C2Dg4BqxUri26Pw9XTsmwd9irgfD59CPNPL01oiNWbbgzwVl3yStR0/YO3ZSyB4MIG8gXc4p2VIXDncOoFjoW7R2azFj+1J4+TpUIp1O9FdnHTmWKhH9InEOXmWKyFd4CCaN1sPioTJwtSBzNvYItb9sBLEsy08eJ2H3S8U7tUBshSm+nz7t0a7No6AvSO3HiDUvL3OheN5nzfS2I67Ow4wrd3XudgxRW3K0ngAuuZMsYKqMf7O5UjIr9XhtQxDPi8LodGoMirZmGzCWqzCzGwjxxLbwoDfh0UegFRdrnyj0M1rI37DnDSD++b1i+6OdtORPQTzZe+txbu4pOjo8BjgFbROVMGejEibu3/ahdKE=----ATTACHMENT:----MzI5MTAxMjgzODMwMzQ5MiAxNDA0ODY0NDgwNjU3MjQ0IDgzNjYyMDIyNjk4NTAxMzM=