mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-22 09:06:10 +02:00
Adding a first version of PushoverHandler
The PushoverHandler sends messages to api.pushover.net. The class depends on the SocketHandler I modified the SocketHandler to make it possible to change the port for subclasses (Pushover needs the explicit port 80 to work) The tests only see if the content sent to the api is correct. The rest should be already covered in the tests for the Sockets.
This commit is contained in:
@@ -22,6 +22,7 @@ use Monolog\Logger;
|
||||
class SocketHandler extends AbstractProcessingHandler
|
||||
{
|
||||
private $connectionString;
|
||||
protected $conntectionPort = -1;
|
||||
private $connectionTimeout;
|
||||
private $resource;
|
||||
private $timeout = 0;
|
||||
@@ -170,7 +171,7 @@ class SocketHandler extends AbstractProcessingHandler
|
||||
*/
|
||||
protected function pfsockopen()
|
||||
{
|
||||
return @pfsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this->connectionTimeout);
|
||||
return @pfsockopen($this->connectionString, $this->conntectionPort, $this->errno, $this->errstr, $this->connectionTimeout);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,7 +179,7 @@ class SocketHandler extends AbstractProcessingHandler
|
||||
*/
|
||||
protected function fsockopen()
|
||||
{
|
||||
return @fsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this->connectionTimeout);
|
||||
return @fsockopen($this->connectionString, $this->conntectionPort, $this->errno, $this->errstr, $this->connectionTimeout);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,7 +191,7 @@ class SocketHandler extends AbstractProcessingHandler
|
||||
{
|
||||
$seconds = floor($this->timeout);
|
||||
$microseconds = round(($this->timeout - $seconds)*1e6);
|
||||
|
||||
|
||||
return stream_set_timeout($this->resource, $seconds, $microseconds);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user