File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,9 +73,9 @@ public function setThreshold($threshold)
7373 /**
7474 * @return array
7575 */
76- public function getProfilerOutput ($ httpCode , $ dbProfiler = 0 )
76+ public function getProfilerOutput ($ httpCode , $ dbProfiler = 0 , $ responseElapsedTime = 0 )
7777 {
78- return $ this ->hasProfilers () && $ this ->shouldLogProfiler ($ httpCode )
78+ return $ this ->hasProfilers () && $ this ->shouldLogProfiler ($ httpCode, $ responseElapsedTime )
7979 ? $ this ->getFormatted ($ dbProfiler )
8080 : [];
8181 }
@@ -85,14 +85,19 @@ public function getProfilerSummary()
8585 return (new ProfilerSummary ($ this ->profilers ))->getSummary ();
8686 }
8787
88- private function shouldLogProfiler ($ httpCode )
88+ private function shouldLogProfiler ($ httpCode, $ responseElapsedTime )
8989 {
9090 if ($ this ->logLevel === self ::LOG_OFF ) {
9191 return false ;
9292 }
9393 if ($ this ->logLevel === self ::LOG_ALWAYS ) {
9494 return true ;
9595 }
96+
97+ if ($ this ->threshold && $ responseElapsedTime > $ this ->threshold ){
98+ return true ;
99+ }
100+
96101 return self ::LOG_ERRORS_ONLY && substr ($ httpCode , 0 , 1 ) != 2 ;
97102 }
98103
You can’t perform that action at this time.
0 commit comments