mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-23 17:46:09 +02:00
Made the write method protected
Tests are not a good reason to make it public.
This commit is contained in:
@@ -41,24 +41,6 @@ class StreamHandler extends AbstractHandler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function write(array $record)
|
||||
{
|
||||
if (null === $this->stream) {
|
||||
if (!$this->url) {
|
||||
throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().');
|
||||
}
|
||||
$this->stream = fopen($this->url, 'a');
|
||||
if (!is_resource($this->stream)) {
|
||||
$this->stream = null;
|
||||
throw new \UnexpectedValueException('The stream could not be opened, "'.$this->url.'" may be an invalid url.');
|
||||
}
|
||||
}
|
||||
fwrite($this->stream, (string) $record['message']);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -69,4 +51,22 @@ class StreamHandler extends AbstractHandler
|
||||
$this->stream = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function write(array $record)
|
||||
{
|
||||
if (null === $this->stream) {
|
||||
if (!$this->url) {
|
||||
throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().');
|
||||
}
|
||||
$this->stream = @fopen($this->url, 'a');
|
||||
if (!is_resource($this->stream)) {
|
||||
$this->stream = null;
|
||||
throw new \UnexpectedValueException('The stream could not be opened, "'.$this->url.'" may be an invalid url.');
|
||||
}
|
||||
}
|
||||
fwrite($this->stream, (string) $record['message']);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user