Skip to content

Commit c06ba5a

Browse files
committed
Add additional params to check if more data in response is needed
(cherry picked from commit 1a76816)
1 parent dfbfff8 commit c06ba5a

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/Profiler.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)