8000 - · symfony/symfony@6429067 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6429067

Browse files
committed
-
1 parent f6921f6 commit 6429067

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,18 @@ public function __invoke(array $record)
3232
{
3333
$hash = $this->requestStack && ($request = $this->requestStack->getCurrentRequest()) ? spl_object_hash($request) : '';
3434

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+
}
3743

3844
$this->records[$hash][] = [
3945
'timestamp' => $timestamp,
40-
'timestamp_rfc3339' => false === $timestamp ? $timestamp : $logDateTime->format(\DateTimeInterface::RFC3339_EXTENDED),
46+
'timestamp_rfc3339' => $timestampRfc3339,
4147
'message' => $record['message'],
4248
'priority' => $record['level'],
4349
'priorityName' => $record['level_name'],

0 commit comments

Comments
 (0)
0