Skip to content

Commit

Permalink
Merge pull request #15 from exodus4d/develop
Browse files Browse the repository at this point in the history
v1.2.2
  • Loading branch information
exodus4d authored Oct 7, 2019
2 parents 71f77bb + 82f69d7 commit 58d0187
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app/Component/Handler/LogFileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,15 @@ public function __construct(string $stream){
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);
}
}
}

Expand Down

0 comments on commit 58d0187

Please sign in to comment.