123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- class Log extends Model
- {
- public static function errorLog($params,$returnValue,$interfaceName,$flag,$headers=[],$responseTime=NULL){
- $data['time']=date("Y-m-d H:i:s",time());
- $data["interfaceName"]=$interfaceName;
- $data['responseTime'] = $responseTime;
- $data["params"]=$params;
- $data["headers"]=$headers;
- $data["returnValue"]=$returnValue;
-
- if($flag){
- $tmpDir="success/";
- }else{
- $tmpDir="error/";
- }
- $name=date("Y-m-d",time()).".txt";
- error_log(json_encode($data)."\n",3,"/log/seafood_log/".$tmpDir.$name);
- }
- public static function scriptLog($params,$returnValue,$interfaceName,$flag,$headers=[],$responseTime=NULL){
- $data['time']=date("Y-m-d H:i:s",time());
- $data["interfaceName"]=$interfaceName;
- $data['responseTime'] = $responseTime;
- $data["params"]=$params;
- $data["headers"]=$headers;
- $data["returnValue"]=$returnValue;
-
- if($flag){
- $tmpDir="script_success/";
- }else{
- $tmpDir="script_error/";
- }
- $name=date("Y-m-d",time()).".txt";
- error_log(json_encode($data)."\n",3,"/log/seafood_log/".$tmpDir.$name);
- }
- }
|