Skip to content

Commit

Permalink
Added WARNING log
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Jul 3, 2019
1 parent bf1e517 commit 65b264a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Elasticsearch/Connections/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ private function wrapHandler(callable $handler): callable
} else {
$connection->markAlive();

if (isset($response['headers']['Warning'])) {
$this->logWarning($request, $response);
}
if (isset($response['body']) === true) {
$response['body'] = stream_get_contents($response['body']);
$this->lastRequest['response']['body'] = $response['body'];
Expand Down Expand Up @@ -342,6 +345,11 @@ public function getHeaders(): array
return $this->headers;
}

public function logWarning(array $request, array $response): void
{
$this->log->warning('Deprecation', $response['headers']['Warning']);
}

/**
* Log a successful request
*
Expand Down

0 comments on commit 65b264a

Please sign in to comment.