Skip to content
This repository was archived by the owner on Aug 12, 2024. It is now read-only.

Commit 1b1a41c

Browse files
authored
Merge pull request #6 from hhxsv5/master
Log request time cost
2 parents adb69fb + 21a0e89 commit 1b1a41c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Api.php

Lines changed: 5 additions & 3 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.0.10';
19+
const VERSION = '1.0.11';
2020

2121
/**
2222
* @var string
@@ -205,11 +205,13 @@ 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;
214216
}
215-
}
217+
}

0 commit comments

Comments
 (0)