1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-10 07:06:40 +02:00

Allow for both mlehner/gelf-php and graylog2/gelf-php usage

This commit is contained in:
Benjamin Zikarsky
2014-02-22 16:11:33 +01:00
parent c8289fd654
commit f0ed3d8054
4 changed files with 143 additions and 5 deletions

View File

@@ -19,7 +19,7 @@ class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
if (!class_exists('\Gelf\Message')) {
$this->markTestSkipped("graylog2/gelf-php not installed");
$this->markTestSkipped("graylog2/gelf-php or mlehner/gelf-php is not installed");
}
}
@@ -47,7 +47,7 @@ class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('meh', $message->getFacility());
$this->assertEquals(null, $message->getLine());
$this->assertEquals(null, $message->getFile());
$this->assertEquals(3, $message->getSyslogLevel());
$this->assertEquals($this->isLegacy() ? 3 : 'error', $message->getLevel());
$this->assertNotEmpty($message->getHost());
$formatter = new GelfMessageFormatter('mysystem');
@@ -184,4 +184,9 @@ class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase
$this->assertArrayHasKey('_EXTkey', $message_array);
$this->assertEquals('pair', $message_array['_EXTkey']);
}
private function isLegacy()
{
return interface_exists('\Gelf\IMessagePublisher');
}
}