Skip to content

Commit 57fe3c7

Browse files
authored
Merge pull request #82 from hhxsv5/master
Log request time cost
2 parents 2b0c0ad + bce6839 commit 57fe3c7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Api.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ abstract class Api
1616
/**
1717
* @var string SDK Version
1818
*/
19-
const VERSION = '1.1.14';
19+
const VERSION = '1.1.15';
2020

2121
/**
2222
* @var string
@@ -205,9 +205,11 @@ public function call($method, $uri, array $params = [], array $headers = [], $ti
205205
if (self::isDebugMode()) {
206206
static::getLogger()->debug(sprintf('Sent a HTTP request#%s: %s', $requestId, $request));
207207
}
208+
$requestStart = microtime(true);
208209
$response = $this->http->request($request, $timeout);
209210
if (self::isDebugMode()) {
210-
static::getLogger()->debug(sprintf('Received a HTTP response#%s: %s', $requestId, $response));
211+
$cost = (microtime(true) - $requestStart) * 1000;
212+
static::getLogger()->debug(sprintf('Received a HTTP response#%s: cost %.2fms, %s', $requestId, $cost, $response));
211213
}
212214

213215
return $response;

0 commit comments

Comments
 (0)