1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-18 19:01:31 +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:
Sebastian Goettschkes
2012-09-24 13:13:18 +02:00
parent 7d0bacf29c
commit f2bac1f351

View File

@@ -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();