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

replace deprecated method calls in GelfMessageFormatter (#1664)

- the getter/setter methods for file, level and facility are deprecated in gelf v1.1
- add those fields as additional instead, as suggested in the gelf spec (https://docs.graylog.org/v1/docs/gelf#gelf-payload-specification)
- update tests to reflect changes
This commit is contained in:
Jan-Eric Ortgies
2022-05-08 23:13:55 +02:00
committed by GitHub
parent acc142c2b7
commit 709cb93aa6
3 changed files with 16 additions and 17 deletions

View File

@@ -41,9 +41,9 @@ class GelfMessageFormatterTest extends TestCase
$this->assertInstanceOf('Gelf\Message', $message);
$this->assertEquals(0, $message->getTimestamp());
$this->assertEquals('log', $message->getShortMessage());
$this->assertEquals('meh', $message->getFacility());
$this->assertEquals(null, $message->getLine());
$this->assertEquals(null, $message->getFile());
$this->assertEquals('meh', $message->getAdditional('facility'));
$this->assertEquals(false, $message->hasAdditional('line'));
$this->assertEquals(false, $message->hasAdditional('file'));
$this->assertEquals($this->isLegacy() ? 3 : 'error', $message->getLevel());
$this->assertNotEmpty($message->getHost());
@@ -73,8 +73,8 @@ class GelfMessageFormatterTest extends TestCase
$message = $formatter->format($record);
$this->assertInstanceOf('Gelf\Message', $message);
$this->assertEquals('test', $message->getFile());
$this->assertEquals(14, $message->getLine());
$this->assertEquals('test', $message->getAdditional('file'));
$this->assertEquals(14, $message->getAdditional('line'));
}
/**
@@ -135,8 +135,8 @@ class GelfMessageFormatterTest extends TestCase
$this->assertInstanceOf('Gelf\Message', $message);
$this->assertEquals("/some/file/in/dir.php", $message->getFile());
$this->assertEquals("56", $message->getLine());
$this->assertEquals("/some/file/in/dir.php", $message->getAdditional('file'));
$this->assertEquals("56", $message->getAdditional('line'));
}
/**