LogstashFormatter example

$records = array_filter($records$this->isHandling(...));

        if ($records) {
            $this->sendToElasticsearch($records);
        }
    }

    protected function getDefaultFormatter(): FormatterInterface
    {
        // Monolog 1.X         if (\defined(LogstashFormatter::class.'::V1')) {
            return new LogstashFormatter('application', null, null, 'ctxt_', LogstashFormatter::V1);
        }

        // Monolog 2.X         return new LogstashFormatter('application');
    }

    private function sendToElasticsearch(array $records): void
    {
        $formatter = $this->getFormatter();

        if (version_compare($this->elasticsearchVersion, '7', '>=')) {
            


        $handler->handleBatch($records);

        $this->assertSame(1, $callCount);
    }

    private function getDefaultFormatter(): FormatterInterface
    {
        // Monolog 1.X         if (\defined(LogstashFormatter::class.'::V1')) {
            return new LogstashFormatter('application', 'my hostname', null, 'ctxt_', LogstashFormatter::V1);
        }

        // Monolog 2.X         return new LogstashFormatter('application', 'my hostname');
    }
}
Home | Imprint | This part of the site doesn't use cookies.