Skip to content

Commit 65b264a

Browse files
committed
Added WARNING log
1 parent bf1e517 commit 65b264a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Elasticsearch/Connections/Connection.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ private function wrapHandler(callable $handler): callable
283283
} else {
284284
$connection->markAlive();
285285

286+
if (isset($response['headers']['Warning'])) {
287+
$this->logWarning($request, $response);
288+
}
286289
if (isset($response['body']) === true) {
287290
$response['body'] = stream_get_contents($response['body']);
288291
$this->lastRequest['response']['body'] = $response['body'];
@@ -342,6 +345,11 @@ public function getHeaders(): array
342345
return $this->headers;
343346
}
344347

348+
public function logWarning(array $request, array $response): void
349+
{
350+
$this->log->warning('Deprecation', $response['headers']['Warning']);
351+
}
352+
345353
/**
346354
* Log a successful request
347355
*

0 commit comments

Comments
 (0)