Explorar o código

Adds support for unix sockets

Kim Pepper %!s(int64=5) %!d(string=hai) anos
pai
achega
bf1a76edb4

+ 2 - 1
src/Monolog/Handler/SyslogUdp/UdpSocket.php

@@ -28,7 +28,8 @@ class UdpSocket
     {
         $this->ip = $ip;
         $this->port = $port;
-        $this->socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
+        $domain = $port === 0 ? AF_UNIX : AF_INET;
+        $this->socket = socket_create($domain, SOCK_DGRAM, SOL_UDP);
     }
 
     public function write($line, $header = "")

+ 1 - 1
src/Monolog/Handler/SyslogUdpHandler.php

@@ -51,7 +51,7 @@ class SyslogUdpHandler extends AbstractSyslogHandler
         $this->ident = $ident;
         $this->rfc = $rfc;
 
-        $this->socket = new UdpSocket($host, $port ?: 514);
+        $this->socket = new UdpSocket($host, $port);
     }
 
     protected function write(array $record): void