mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-07 21:56:31 +02:00
LineFormatter: context and extra optionally not shown when empty
This commit is contained in:
@@ -77,6 +77,20 @@ class LineFormatterTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('['.date('Y-m-d').'] meh.ERROR: log [] test {"ip":"127.0.0.1"}'."\n", $message);
|
||||
}
|
||||
|
||||
public function testContextAndExtraOptionallyNotShownIfEmpty()
|
||||
{
|
||||
$formatter = new LineFormatter(null, 'Y-m-d', false, true);
|
||||
$message = $formatter->format(array(
|
||||
'level_name' => 'ERROR',
|
||||
'channel' => 'meh',
|
||||
'context' => array(),
|
||||
'datetime' => new \DateTime,
|
||||
'extra' => array(),
|
||||
'message' => 'log',
|
||||
));
|
||||
$this->assertEquals('['.date('Y-m-d').'] meh.ERROR: log '."\n", $message);
|
||||
}
|
||||
|
||||
public function testDefFormatWithObject()
|
||||
{
|
||||
$formatter = new LineFormatter(null, 'Y-m-d');
|
||||
|
Reference in New Issue
Block a user