|
@@ -33,7 +33,7 @@ class Log { |
|
@@ -33,7 +33,7 @@ class Log { |
33
|
*/
|
33
|
*/
|
34
|
public function __construct()
|
34
|
public function __construct()
|
35
|
{
|
35
|
{
|
36
|
- $this->filename['default'] = LOG_PATH.'/'.app()->nowDate().'.error.log';
|
36
|
+ $this->setFilename();
|
37
|
}
|
37
|
}
|
38
|
|
38
|
|
39
|
/**
|
39
|
/**
|
|
@@ -48,7 +48,7 @@ class Log { |
|
@@ -48,7 +48,7 @@ class Log { |
48
|
self::getInstance()->setFilename($filename);
|
48
|
self::getInstance()->setFilename($filename);
|
49
|
}
|
49
|
}
|
50
|
|
50
|
|
51
|
- self::getInstance()->message[md5($filename)][] = $message;
|
51
|
+ self::getInstance()->message[$filename ? md5($filename) : 'default'][] = $message;
|
52
|
|
52
|
|
53
|
}
|
53
|
}
|
54
|
|
54
|
|
|
@@ -71,16 +71,18 @@ class Log { |
|
@@ -71,16 +71,18 @@ class Log { |
71
|
* @author:dc
|
71
|
* @author:dc
|
72
|
* @time 2023/3/14 11:11
|
72
|
* @time 2023/3/14 11:11
|
73
|
*/
|
73
|
*/
|
74
|
- private function setFilename($filename){
|
74
|
+ private function setFilename($filename=null){
|
|
|
75
|
+ if($filename){
|
|
|
76
|
+ $this->filename[md5($filename)] = $filename;
|
|
|
77
|
+ }else{
|
|
|
78
|
+ $this->filename['default'] = $filename = LOG_PATH.'/'.app()->nowDate().'.error.log';
|
|
|
79
|
+ }
|
75
|
|
80
|
|
76
|
// 创建目录
|
81
|
// 创建目录
|
77
|
if(!is_dir(dirname($filename))){
|
82
|
if(!is_dir(dirname($filename))){
|
78
|
@mkdir(dirname($filename),0755,true);
|
83
|
@mkdir(dirname($filename),0755,true);
|
79
|
}
|
84
|
}
|
80
|
|
85
|
|
81
|
- $this->filename[md5($filename)] = $filename;
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
}
|
86
|
}
|
85
|
|
87
|
|
86
|
/**
|
88
|
/**
|