|
|
@@ -90,6 +90,21 @@ class LineFormatterTest extends \PHPUnit_Framework_TestCase
|
|
|
$this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foobar [] {"foo":"[object] (Monolog\\\\Formatter\\\\TestFoo: {\\"foo\\":\\"foo\\"})","bar":"[object] (Monolog\\\\Formatter\\\\TestBar: {})","baz":[],"res":"[resource]"}'."\n", $message);
|
|
|
}
|
|
|
|
|
|
+ public function testDefFormatWithException()
|
|
|
+ {
|
|
|
+ $formatter = new LineFormatter(null, 'Y-m-d');
|
|
|
+ $message = $formatter->format(array(
|
|
|
+ 'level_name' => 'CRITICAL',
|
|
|
+ 'channel' => 'core',
|
|
|
+ 'context' => array('exception' => new \RuntimeException('Foo')),
|
|
|
+ 'datetime' => new \DateTime,
|
|
|
+ 'extra' => array(),
|
|
|
+ 'message' => 'foobar',
|
|
|
+ ));
|
|
|
+
|
|
|
+ $this->assertEquals('['.date('Y-m-d').'] core.CRITICAL: foobar {"exception":"[object] (RuntimeException: Foo at '.substr(json_encode(__FILE__), 1, -1).':'.(__LINE__-6).')"} []'."\n", $message);
|
|
|
+ }
|
|
|
+
|
|
|
public function testBatchFormat()
|
|
|
{
|
|
|
$formatter = new LineFormatter(null, 'Y-m-d');
|