1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 12:47:39 +02:00

isolate fwrite to allow override

This commit is contained in:
Jay MOULIN
2016-11-14 23:35:47 +01:00
committed by Jordi Boggiano
parent 2133e01288
commit 09a68c81e3

View File

@@ -113,13 +113,23 @@ class StreamHandler extends AbstractProcessingHandler
flock($this->stream, LOCK_EX);
}
fwrite($this->stream, (string) $record['formatted']);
$this->streamWrite($this->stream, $record);
if ($this->useLocking) {
flock($this->stream, LOCK_UN);
}
}
/**
* Write to stream
* @param resource $stream
* @param array $record
*/
protected function streamWrite($stream, array $record)
{
fwrite($stream, (string)$record['formatted']);
}
private function customErrorHandler($code, $msg)
{
$this->errorMessage = preg_replace('{^(fopen|mkdir)\(.*?\): }', '', $msg);