mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-02 03:10:15 +02:00
Merge pull request #1540 from yi-yang-github/main
#1539 fix timezone when it's DateTimeImmutable
This commit is contained in:
@@ -97,9 +97,12 @@ class SyslogUdpHandler extends AbstractSyslogHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->rfc === self::RFC3164 && ($datetime instanceof \DateTimeImmutable || $datetime instanceof \DateTime)) {
|
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) {
|
if ($this->rfc === self::RFC3164) {
|
||||||
return "<$priority>" .
|
return "<$priority>" .
|
||||||
|
Reference in New Issue
Block a user