1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-03 19:57:41 +02:00

Added millis

This commit is contained in:
Malte Blättermann
2016-03-12 21:53:27 +01:00
committed by Jordi Boggiano
parent a5f2734e8c
commit 9ef18f111f
2 changed files with 4 additions and 2 deletions

View File

@@ -36,7 +36,9 @@ class ElasticaFormatter extends NormalizerFormatter
*/ */
public function __construct($index, $type) public function __construct($index, $type)
{ {
parent::__construct(\DateTime::ISO8601); // elasticsearch requires a ISO 8601 format date with optional millisecond precision.
parent::__construct('Y-m-d\TH:i:s.uP');
$this->index = $index; $this->index = $index;
$this->type = $type; $this->type = $type;
} }

View File

@@ -42,7 +42,7 @@ class ElasticaFormatterTest extends \PHPUnit_Framework_TestCase
// expected values // expected values
$expected = $msg; $expected = $msg;
$expected['datetime'] = '1970-01-01T00:00:00+0000'; $expected['datetime'] = '1970-01-01T00:00:00.000000+0000';
$expected['context'] = array( $expected['context'] = array(
'class' => '[object] (stdClass: {})', 'class' => '[object] (stdClass: {})',
'foo' => 7, 'foo' => 7,