Skip to content

Commit dfbfff8

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

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/Profiler.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ class Profiler
3030
*/
3131
private $logLevel;
3232

33+
/**
34+
* @var int
35+
*/
36+
private $threshold;
37+
3338
public function __construct()
3439
{
3540
$this->profilers = [];
@@ -59,6 +64,12 @@ public function setLogLevel($logLevel)
5964
return $this;
6065
}
6166

67+
public function setThreshold($threshold)
68+
{
69+
$this->threshold = (int) $threshold;
70+
return $this;
71+
}
72+
6273
/**
6374
* @return array
6475
*/
@@ -85,6 +96,11 @@ private function shouldLogProfiler($httpCode)
8596
return self::LOG_ERRORS_ONLY && substr($httpCode, 0, 1) != 2;
8697
}
8798

99+
public function shouldLogProfilerOutput($responseElapsedTimeInMs)
100+
{
101+
return $responseElapsedTimeInMs > $this->threshold;
102+
}
103+
88104
/**
89105
* @return array
90106
*/

src/RunnerAbstract.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ public function setProfilerLogLevel($profilerLogLevel)
123123
return $this;
124124
}
125125

126+
public function setProfilerLogThreshold($threshold)
127+
{
128+
$this->profiler->setThreshold($threshold);
129+
return $this;
130+
}
131+
126132
/**
127133
* @return Profiler
128134
*/

0 commit comments

Comments
 (0)