...
|
...
|
@@ -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])){
|
|
|
$fo = @fopen($fn,'a');
|
|
|
if($fo){
|
|
|
foreach ($this->message[$key] as &$log){
|
|
|
@fwrite($fo,$log.PHP_EOL);
|
|
|
}
|
|
|
@fclose($fo);
|
|
|
}
|
|
|
|
|
|
array_unshift($this->message[$key],app()->nowDateTime());
|
|
|
$this->message[$key][] = PHP_EOL;
|
|
|
$log = null;
|
|
|
unset($log);
|
|
|
|
|
|
@file_put_contents(
|
|
|
$fn,
|
|
|
implode(PHP_EOL."\t",$this->message[$key]),
|
|
|
FILE_APPEND
|
|
|
);
|
|
|
$this->message[$key] = [];
|
|
|
$this->message[$key] = null;
|
|
|
unset($this->message[$key]);
|
|
|
}
|
|
|
|
|
|
}
|
...
|
...
|
|