@@ -76,7 +76,7 @@ public function setThreshold($threshold)
7676 public function getProfilerOutput ($ httpCode , $ dbProfiler = 0 , $ responseElapsedTime = 0 )
7777 {
7878 return $ this ->hasProfilers () && $ this ->shouldLogProfiler ($ httpCode , $ responseElapsedTime )
79- ? $ this ->getFormatted ($ dbProfiler )
79+ ? $ this ->getFormatted ($ dbProfiler, $ responseElapsedTime )
8080 : [];
8181 }
8282
@@ -94,22 +94,22 @@ private function shouldLogProfiler($httpCode, $responseElapsedTime)
9494 return true ;
9595 }
9696
97- if ($ this ->threshold && $ responseElapsedTime > $ this -> threshold ){
97+ if ($ this ->isRequestTresholdExceded ( $ responseElapsedTime) ){
9898 return true ;
9999 }
100100
101101 return self ::LOG_ERRORS_ONLY && substr ($ httpCode , 0 , 1 ) != 2 ;
102102 }
103103
104- public function shouldLogProfilerOutput ( $ responseElapsedTimeInMs )
104+ public function isRequestTresholdExceded ( $ responseElapsedTime )
105105 {
106- return $ responseElapsedTimeInMs > $ this ->threshold ;
106+ return $ this -> threshold && $ responseElapsedTime > $ this ->threshold ;
107107 }
108108
109109 /**
110110 * @return array
111111 */
112- private function getFormatted ($ dbProfiler )
112+ private function getFormatted ($ dbProfiler, $ responseElapsedTime )
113113 {
114114 if (!$ this ->hasFormatted ()) {
115115 $ this ->formatted = [];
@@ -124,7 +124,7 @@ private function getFormatted($dbProfiler)
124124 return $ this ->formatted ;
125125 }
126126
127- if ((int ) $ dbProfiler === 2 ) {
127+ if ((int ) $ dbProfiler === 2 || $ this -> isRequestTresholdExceded ( $ responseElapsedTime ) ) {
128128 $ timelineFormatted = [];
129129 foreach ($ this ->timeline as $ queries ) {
130130 foreach ($ queries as $ key => $ query ) {
0 commit comments