mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
单个日志文件支持大小设置
This commit is contained in:
@@ -20,10 +20,10 @@ class File
|
||||
{
|
||||
protected $config = [
|
||||
'time_format' => ' c ',
|
||||
'single' => false,
|
||||
'file_size' => 2097152,
|
||||
'path' => LOG_PATH,
|
||||
'apart_level' => [],
|
||||
'single' => false,
|
||||
];
|
||||
|
||||
protected $writed = [];
|
||||
@@ -84,7 +84,7 @@ class File
|
||||
protected function write($message, $destination, $apart = false)
|
||||
{
|
||||
//检测日志文件大小,超过配置大小则备份日志文件重新生成
|
||||
if (!$this->config['single'] && is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) {
|
||||
if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) {
|
||||
rename($destination, dirname($destination) . DS . time() . '-' . basename($destination));
|
||||
$this->writed[$destination] = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user