1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-07-30 18:00:17 +02:00

Merge pull request #1540 from yi-yang-github/main

#1539 fix timezone when it's DateTimeImmutable
This commit is contained in:
Jordi Boggiano
2021-04-04 16:10:32 +02:00
committed by GitHub

View File

@@ -97,9 +97,12 @@ class SyslogUdpHandler extends AbstractSyslogHandler
}
if ($this->rfc === self::RFC3164 && ($datetime instanceof \DateTimeImmutable || $datetime instanceof \DateTime)) {
$datetime->setTimezone(new \DateTimeZone('UTC'));
$dateNew = $datetime->setTimezone(new \DateTimeZone('UTC'));
$date = $dateNew->format($this->dateFormats[$this->rfc]);
}
else {
$date = $datetime->format($this->dateFormats[$this->rfc]);
}
$date = $datetime->format($this->dateFormats[$this->rfc]);
if ($this->rfc === self::RFC3164) {
return "<$priority>" .