添加响应时间日志

main
fengxinyhyl 5 months ago
parent 11340059c6
commit 3241b0af80
  1. 5
      crmeb/listens/AppEnd.php

@ -23,11 +23,12 @@ class AppEnd
if(isset($header['x-token']) and $header['x-token']){ if(isset($header['x-token']) and $header['x-token']){
$token = $header['x-token']; $token = $header['x-token'];
} }
$runTime = microtime(true) - Request::time(true);
$jsonRes = json_encode($response, JSON_UNESCAPED_UNICODE); $jsonRes = json_encode($response, JSON_UNESCAPED_UNICODE);
if(is_array($response) and (strpos($jsonRes, '<!DOCTYPE html>') === false and strpos($jsonRes, '<span') === false)) { if(is_array($response) and (strpos($jsonRes, '<!DOCTYPE html>') === false and strpos($jsonRes, '<span') === false)) {
Log::info(Request::url(). ' params: ' . json_encode($params) ." response: " . $jsonRes ); Log::info(Request::url(). ' runtime is ' . $runTime . ' params: ' . json_encode($params) ." response: " . $jsonRes );
}else{ }else{
Log::info(Request::url(). ' params: ' . json_encode($params)); Log::info(Request::url(). ' runtime is ' . $runTime . ' params: ' . json_encode($params));
} }
// Log::info(" token: " . $token); // Log::info(" token: " . $token);
} }

Loading…
Cancel
Save