File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
src/Symfony/Bridge/Monolog/Processor Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -32,12 +32,18 @@ public function __invoke(array $record)
32
32
{
33
33
$ hash = $ this ->requestStack && ($ request = $ this ->requestStack ->getCurrentRequest ()) ? spl_object_hash ($ request ) : '' ;
34
34
35
- $ timestamp = $ record ['datetime ' ] instanceof \DateTimeInterface ? $ record ['datetime ' ]->getTimestamp () : strtotime ($ record ['datetime ' ]);
36
- $ logDateTime = $ record ['datetime ' ] instanceof \DateTimeInterface ? $ record ['datetime ' ] : (new \DateTimeImmutable ())->setTimestamp (strtotime ($ record ['datetime ' ]));
35
+ $ timestamp = $ timestampRfc3339 = false ;
36
+ if ($ record ['datetime ' ] instanceof \DateTimeInterface) {
37
+ $ timestamp = $ record ['datetime ' ]->getTimestamp ();
38
+ $ timestampRfc3339 = $ record ['datetime ' ]->format (\DateTimeInterface::RFC3339_EXTENDED );
39
+ } elseif (false !== strtotime ($ record ['datetime ' ])) {
40
+ $ timestamp = strtotime ($ record ['datetime ' ]);
41
+ $ timestampRfc3339 = (new \DateTimeImmutable ())->setTimestamp ($ timestamp )->format (\DateTimeInterface::RFC3339_EXTENDED );
42
+ }
37
43
38
44
$ this ->records [$ hash ][] = [
39
45
'timestamp ' => $ timestamp ,
40
- 'timestamp_rfc3339 ' => false === $ timestamp ? $ timestamp : $ logDateTime -> format (\DateTimeInterface:: RFC3339_EXTENDED ) ,
46
+ 'timestamp_rfc3339 ' => $ timestampRfc3339 ,
41
47
'message ' => $ record ['message ' ],
42
48
'priority ' => $ record ['level ' ],
43
49
'priorityName ' => $ record ['level_name ' ],
You can’t perform that action at this time.
0 commit comments