|
|
@@ -119,6 +119,35 @@ class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @covers Monolog\Formatter\GelfMessageFormatter::format
|
|
|
+ */
|
|
|
+ public function testFormatWithContextContainingException()
|
|
|
+ {
|
|
|
+ $formatter = new GelfMessageFormatter();
|
|
|
+ $record = array(
|
|
|
+ 'level' => Logger::ERROR,
|
|
|
+ 'level_name' => 'ERROR',
|
|
|
+ 'channel' => 'meh',
|
|
|
+ 'context' => array('from' => 'logger', 'exception' => [
|
|
|
+ 'class' => '\Exception',
|
|
|
+ 'file' => '/some/file/in/dir.php:56',
|
|
|
+ 'trace' => ['/some/file/1.php:23', '/some/file/2.php:3']
|
|
|
+ ]),
|
|
|
+ 'datetime' => new \DateTime("@0"),
|
|
|
+ 'extra' => array(),
|
|
|
+ 'message' => 'log'
|
|
|
+ );
|
|
|
+
|
|
|
+ $message = $formatter->format($record);
|
|
|
+
|
|
|
+ $this->assertInstanceOf('Gelf\Message', $message);
|
|
|
+
|
|
|
+ $this->assertEquals("/some/file/in/dir.php", $message->getFile());
|
|
|
+ $this->assertEquals("56", $message->getLine());
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @covers Monolog\Formatter\GelfMessageFormatter::format
|
|
|
*/
|