作者 邓超

x

正在显示 1 个修改的文件 包含 14 行增加11 行删除
... ... @@ -48,7 +48,7 @@ class Log {
self::getInstance()->setFilename($filename);
}
self::getInstance()->message[$filename ? md5($filename) : 'default'][] = $message;
self::getInstance()->message[$filename ? md5($filename) : 'default'][] = date('Y-m-d H:i:s ').$message;
}
... ... @@ -94,16 +94,19 @@ class Log {
foreach ($this->filename as $key=>$fn){
if(!empty($this->message[$key])){
array_unshift($this->message[$key],app()->nowDateTime());
$this->message[$key][] = PHP_EOL;
@file_put_contents(
$fn,
implode(PHP_EOL."\t",$this->message[$key]),
FILE_APPEND
);
$this->message[$key] = [];
$fo = @fopen($fn,'a');
if($fo){
foreach ($this->message[$key] as &$log){
@fwrite($fo,$log.PHP_EOL);
}
@fclose($fo);
}
$log = null;
unset($log);
$this->message[$key] = null;
unset($this->message[$key]);
}
}
... ...