Skip to content

Commit

Permalink
Merge pull request #3 from snappmarket/develop
Browse files Browse the repository at this point in the history
change vars format to camelCase
  • Loading branch information
taghad committed Aug 9, 2023
2 parents 397cbba + 1e391da commit 4fd320e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/GuzzleLogger/GuzzleLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ public function __construct($logger)
$this->logger = $logger;
}

public function handleRequestStats($service_name, $stats) {
public function handleRequestStats($serviceName, $stats) {
$url = $stats->getHandlerStats()["url"];
$request_duration = $stats->getTransferTime() * 1000; //ms
$status_code = 408;
$requestDuration = $stats->getTransferTime() * 1000; //ms
$statusCode = 408;
if ($stats->hasResponse()) {
$status_code = $stats->getResponse()->getStatusCode();
$statusCode = $stats->getResponse()->getStatusCode();
$response = $stats->getResponse()->getBody();
} else {
$response = $stats->getHandlerErrorData();
}
$this->logRecord($service_name, $status_code, $response, $request_duration, $url);
$this->logRecord($serviceName, $statusCode, $response, $requestDuration, $url);
}

public function logRecord(string $serviceName, $status_code, $response, $request_duration, $url): void
public function logRecord(string $serviceName, $statusCode, $response, $requestDuration, $url): void
{
$this->logger->info(
'Third party logger log for: ' . $serviceName . ' service',
[
"response_status_code" => $status_code,
"request_duration" => $request_duration, //ms
"response_status_code" => $statusCode,
"request_duration" => $requestDuration, //ms
"response_body" => $response,
"url" => $url,
]
Expand Down

0 comments on commit 4fd320e

Please sign in to comment.