log 初始化
记录 log
protected function processLogs($logs)
{
$text='';
foreach($logs as $log) {
$text.=$this->formatLogMessage($log[0],$log[1],$log[2],$log[3]);
}
$a = $this->getLogPath();
$b = $this->getLogFile();
$logFile=$this->getLogPath().DIRECTORY_SEPARATOR.$this->getLogFile();
$fp=@fopen($logFile,'a');
@flock($fp,LOCK_EX);
if(@filesize($logFile)>$this->getMaxFileSize()*1024)
{
$this->rotateFiles();
@flock($fp,LOCK_UN);
@fclose($fp);
@file_put_contents($logFile,$text,FILE_APPEND|LOCK_EX);
}
else
{
@fwrite($fp,$text); // 写入日志
@flock($fp,LOCK_UN);
@fclose($fp);
}