正在显示
1 个修改的文件
包含
4 行增加
和
4 行删除
| @@ -84,7 +84,7 @@ class Es { | @@ -84,7 +84,7 @@ class Es { | ||
| 84 | try { | 84 | try { |
| 85 | $staTime = microtime(true); | 85 | $staTime = microtime(true); |
| 86 | $response = $this->client->search($params); | 86 | $response = $this->client->search($params); |
| 87 | - $this->timeLog($staTime); | 87 | + $this->timeLog($staTime,$params); |
| 88 | }catch (\Throwable $e) { | 88 | }catch (\Throwable $e) { |
| 89 | logs("搜索数据es:".$e->getMessage()." \n ".json_encode($params)."\n".$e->getTraceAsString()); | 89 | logs("搜索数据es:".$e->getMessage()." \n ".json_encode($params)."\n".$e->getTraceAsString()); |
| 90 | return []; | 90 | return []; |
| @@ -94,10 +94,10 @@ class Es { | @@ -94,10 +94,10 @@ class Es { | ||
| 94 | 94 | ||
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | - private function timeLog($staTime){ | 97 | + private function timeLog($staTime,$query=[]){ |
| 98 | $endTime = microtime(true); | 98 | $endTime = microtime(true); |
| 99 | if($endTime-$staTime >= 2){ | 99 | if($endTime-$staTime >= 2){ |
| 100 | - logs('查询es耗时:'.($endTime-$staTime).'s'); | 100 | + logs('查询es耗时:'.($endTime-$staTime).'s'."\n".json_decode($query)); |
| 101 | } | 101 | } |
| 102 | } | 102 | } |
| 103 | 103 | ||
| @@ -117,7 +117,7 @@ class Es { | @@ -117,7 +117,7 @@ class Es { | ||
| 117 | try { | 117 | try { |
| 118 | $staTime = microtime(true); | 118 | $staTime = microtime(true); |
| 119 | $response = $this->client->count($params); | 119 | $response = $this->client->count($params); |
| 120 | - $this->timeLog($staTime); | 120 | + $this->timeLog($staTime,$params); |
| 121 | }catch (\Throwable $e) { | 121 | }catch (\Throwable $e) { |
| 122 | logs("搜索数据es:".$e->getMessage()." \n ".json_encode($params)."\n".$e->getTraceAsString()); | 122 | logs("搜索数据es:".$e->getMessage()." \n ".json_encode($params)."\n".$e->getTraceAsString()); |
| 123 | return 0; | 123 | return 0; |
-
请 注册 或 登录 后发表评论