Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Backported CFileLogRoute code from Yii2

  • Loading branch information...
commit cfa8fd3eaa49f9a285c5b5208234f365c35e0d61 1 parent cdf7240
@samdark samdark authored
Showing with 15 additions and 6 deletions.
  1. +15 −6 framework/logging/CFileLogRoute.php
View
21 framework/logging/CFileLogRoute.php
@@ -135,17 +135,26 @@ public function setMaxLogFiles($value)
*/
protected function processLogs($logs)
{
+ $text='';
+ foreach($logs as $log)
+ $text.=$this->formatLogMessage($log[0],$log[1],$log[2],$log[3]);
+
$logFile=$this->getLogPath().DIRECTORY_SEPARATOR.$this->getLogFile();
$fp=@fopen($logFile,'a');
@flock($fp,LOCK_EX);
if(@filesize($logFile)>$this->getMaxFileSize()*1024)
+ {
$this->rotateFiles();
- $buffer='';
- foreach($logs as $log)
- $buffer.=$this->formatLogMessage($log[0],$log[1],$log[2],$log[3]);
- @fwrite($fp,$buffer);
- @flock($fp,LOCK_UN);
- @fclose($fp);
+ @flock($fp,LOCK_UN);
+ @fclose($fp);

There are code with spaces instead tabs

@samdark Owner
samdark added a note

Thanks! Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ @file_put_contents($logFile,$text,FILE_APPEND|LOCK_EX);
+ }
+ else
+ {
+ @fwrite($fp,$text);
+ @flock($fp,LOCK_UN);
+ @fclose($fp);
+ }
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.