8000 [HttpClient] Add `total_time` to the response log · symfony/symfony@c8bfb79 · GitHub
[go: up one dir, main page]

Skip to content

Commit c8bfb79

Browse files
jwagenicolas-grekas
authored andcommitted
[HttpClient] Add total_time to the response log
1 parent 4348890 commit c8bfb79

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Component/HttpClient/Response/TransportResponseTrait.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,11 @@ public static function stream(iterable $responses, ?float $timeout = null): \Gen
231231
} elseif ($chunk instanceof FirstChunk) {
232232
if ($response->logger) {
233233
$info = $response->getInfo();
234-
$response->logger->info(\sprintf('Response: "%s %s"', $info['http_code'], $info['url']));
234+
$response->logger->info('Response: "{http_code} {url}" {total_time} seconds', [
235+
'http_code' => $info['http_code'],
236+
'url' => $info['url'],
237+
'total_time' => $info['total_time'],
238+
]);
235239
}
236240

237241
$response->inflate = \extension_loaded('zlib') && $response->inflate && 'gzip' === ($response->headers['content-encoding'][0] ?? null) ? inflate_init(\ZLIB_ENCODING_GZIP) : null;

0 commit comments

Comments
 (0)
0