mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-18 02:41:24 +02:00
Changing the SocketHandler to call generateDataStream when writing to socket
Now the write method does not to be overwritten when the format of the dataStream the Socket sends has to be altered in any way the formatter cannot handle (See the PushoverHandler for an example)
This commit is contained in:
@@ -53,7 +53,8 @@ class SocketHandler extends AbstractProcessingHandler
|
||||
public function write(array $record)
|
||||
{
|
||||
$this->connectIfNotConnected();
|
||||
$this->writeToSocket((string) $record['formatted']);
|
||||
$data = $this->generateDataStream($record);
|
||||
$this->writeToSocket($data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,6 +228,11 @@ class SocketHandler extends AbstractProcessingHandler
|
||||
$this->connect();
|
||||
}
|
||||
|
||||
protected function generateDataStream($record)
|
||||
{
|
||||
return (string) $record['formatted'];
|
||||
}
|
||||
|
||||
private function connect()
|
||||
{
|
||||
$this->createSocketResource();
|
||||
|
Reference in New Issue
Block a user