Merge pull request #15 from exodus4d/develop

v1.2.2
This commit is contained in:
Mark Friedrich
2019-10-07 17:23:07 +02:00
committed by GitHub

View File

@@ -44,11 +44,15 @@ class LogFileHandler {
public function write(array $log){
$log = (string)json_encode($log, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
if( !empty($log) ){
$stream = fopen($this->stream, 'a');
flock($stream, LOCK_EX);
fwrite($stream, $log . PHP_EOL);
flock($stream, LOCK_UN);
fclose($stream);
if($stream = fopen($this->stream, 'a')){
flock($stream, LOCK_EX);
fwrite($stream, $log . PHP_EOL);
flock($stream, LOCK_UN);
fclose($stream);
// logs should be writable for non webSocket user too
@chmod($this->stream, 0666);
}
}
}