File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 */
Original file line number Diff line number Diff 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 */
You can’t perform that action at this time.
0 commit comments