Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "gmponos/guzzle_logger",
"name": "covergenius/guzzle_logger",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think you'll get this merged with references to our own repo still in it ;-)
Then again, there already are #50 and #52 which do the same thing as this PR, will have their 1st birthday in the very near future, and also have not yet been merged.

Don't think this package is still maintained?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I did not mean to open this PR.

We created another repo and will maintain it since they haven't been maintaning it. https://packagist.org/packages/covergenius/guzzle_logger

"description": "A Guzzle middleware to log request and responses automatically",
"keywords": [
"psr3",
Expand All @@ -8,7 +8,7 @@
"logging"
],
"license": "MIT",
"homepage": "https://github.com/gmponos/guzzle-log-middleware",
"homepage": "https://github.com/covergenius/guzzle-log-middleware",
"authors": [
{
"name": "George Mponos",
Expand All @@ -29,10 +29,12 @@
"php": "^7.2 || ^8.0",
"ext-json": "*",
"guzzlehttp/guzzle": "^6.1 || ^7.0.1",
"guzzlehttp/promises": "^2",
"guzzlehttp/psr7": "^1.7 || ^2.0",
"psr/log": "^1.1 || ^2.0 || ^3.0"
},
"require-dev": {
"colinodell/psr-testlogger": "^1.3",
"phpstan/phpstan": "~0.12.32",
"phpstan/phpstan-phpunit": "^0.12.11",
"phpstan/phpstan-strict-rules": "^0.12.2",
Expand Down
6 changes: 3 additions & 3 deletions src/LogMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ private function handleSuccess(RequestInterface $request, array $options): calla
*/
private function handleFailure(RequestInterface $request, array $options): callable
{
return function (\Exception $reason) use ($request, $options) {
return function ($reason) use ($request, $options) {
if ($reason instanceof RequestException && $reason->hasResponse() === true) {
$this->handler->log($this->logger, $request, $reason->getResponse(), $reason, $this->stats, $options);
return \GuzzleHttp\Promise\rejection_for($reason);
return \GuzzleHttp\Promise\Create::rejectionFor($reason);
}

$this->handler->log($this->logger, $request, null, $reason, $this->stats, $options);
return \GuzzleHttp\Promise\rejection_for($reason);
return \GuzzleHttp\Promise\Create::rejectionFor($reason);
};
}

Expand Down
2 changes: 1 addition & 1 deletion tests/AbstractLoggerMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Log\Test\TestLogger;
use ColinODell\PsrTestLogger\TestLogger;

abstract class AbstractLoggerMiddlewareTest extends TestCase
{
Expand Down