1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-11 23:54:04 +02:00

Convert level/levelName to enums (#1656)

This commit is contained in:
Jordi Boggiano
2022-04-19 21:49:03 +02:00
committed by GitHub
parent 248673e858
commit 2d006a8472
138 changed files with 1297 additions and 1216 deletions

View File

@@ -15,7 +15,7 @@ use Elasticsearch\ClientBuilder;
use Monolog\Formatter\ElasticsearchFormatter;
use Monolog\Formatter\NormalizerFormatter;
use Monolog\Test\TestCase;
use Monolog\Logger;
use Monolog\Level;
use Elasticsearch\Client;
class ElasticsearchHandlerTest extends TestCase
@@ -56,7 +56,7 @@ class ElasticsearchHandlerTest extends TestCase
public function testHandle()
{
// log message
$msg = $this->getRecord(Logger::ERROR, 'log', context: ['foo' => 7, 'bar', 'class' => new \stdClass], datetime: new \DateTimeImmutable("@0"));
$msg = $this->getRecord(Level::Error, 'log', context: ['foo' => 7, 'bar', 'class' => new \stdClass], datetime: new \DateTimeImmutable("@0"));
// format expected result
$formatter = new ElasticsearchFormatter($this->options['index'], $this->options['type']);
@@ -172,7 +172,7 @@ class ElasticsearchHandlerTest extends TestCase
*/
public function testHandleIntegration()
{
$msg = $this->getRecord(Logger::ERROR, 'log', context: ['foo' => 7, 'bar', 'class' => new \stdClass], datetime: new \DateTimeImmutable("@0"));
$msg = $this->getRecord(Level::Error, 'log', context: ['foo' => 7, 'bar', 'class' => new \stdClass], datetime: new \DateTimeImmutable("@0"));
$expected = $msg->toArray();
$expected['datetime'] = $msg['datetime']->format(\DateTime::ISO8601);