gmponos/guzzle_logger
A Guzzle middleware to log request and responses automatically
v2.2.0
2.3M downloads/mo
#4940 most downloaded on Packagist
gmponos/guzzle-log-middleware
What this package is like to depend on
Last release 4 years ago
no release in 18 months
Ships unpredictably
gaps range from 2 weeks to 1.7 years
Nearly every release is documented
notes for 13 of 14 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
14 releases · first in 2016
0 releases in the last 12 months
see the full history below
Release timeline
14 releases · Apr 2016 to Apr 2022
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Releases
latest 14-
v2.2.004 Apr 2022Nothing published for this version
-
v2.1.018 Mar 2022Release notes
Open source →Changes
- Allow PHP 8
- Fix a deprecation on MultiRecordArrayHandler regarding query
-
v2.0.005 Jul 2020Release notes
Open source →Changed
- [BC] Changed the signature of
HandlerInterface::logto allow Throwables. Now the signature is
HandlerInterface::log( LoggerInterface $logger, RequestInterface $request, ?ResponseInterface $response = null, ?Throwable $exception = null, ?TransferStats $stats = null, array $options = [] )
- Allow guzzle 7
Release notes
Open source →Changed
- [BC] Changed the signature of
HandlerInterface::logto allow Throwables. Now the signature is
HandlerInterface::log( LoggerInterface $logger, RequestInterface $request, ?ResponseInterface $response = null, ?Throwable $exception = null, ?TransferStats $stats = null, array $options = [] )- Allow guzzle 7
- [BC] Changed the signature of
-
v1.1.003 Sep 2019 -
v1.0.118 Jun 2019 -
v1.0.028 Dec 2018 -
v0.8.013 Dec 2018Release notes
Open source →Changes
- Set as the default strategy in all handlers the
FixedStrategy
BREAKING CHANGES
LogLevelStrategyclass is removed and it has been separated to smaller classes.
Check theaddedsection below.- Changed the namespaces completely. The new Namespace is
GuzzleLogMiddlewareinstead ofGmponos\GuzzleLogger.
Check the README file for instructions. - Changed the signature of function
HandlerInterface::log. - Changed
ArrayHandlertoMultiRecordArrayHandler
Added
FixedStrategya strategy that you are able to set one level for all your logs.ThresholdLevelStrategya strategy that works with thresholds depending on the status code.StatusCodeStrategya strategy that you are able to set a specific log level per status code.
Release notes
Open source →Changes
- Set as the default strategy in all handlers the
FixedStrategy
BREAKING CHANGES
LogLevelStrategyclass is removed and it has been separated to smaller classes. Check theaddedsection below.- Changed the namespaces completely. The new namespace is
GuzzleLogMiddlewareinstead ofGmponos\GuzzleLogger. Check the README file for instructions. - Changed the signature of function
HandlerInterface::log. - Changed
ArrayHandlertoMultiRecordArrayHandler
Added
FixedStrategya strategy that you are able to set one level for all your logs.ThresholdLevelStrategya strategy that works with thresholds depending on the status code.StatusCodeStrategya strategy that you are able to set a specific log level per status code.
- Set as the default strategy in all handlers the
-
v0.7.031 Oct 2018Release notes
Open source →Changed
- BREAKING CHANGE Dropped support for PHP 5 and require PHP 7.2 as minimum version.
Release notes
Open source →Changed
- BREAKING CHANGE Dropped support for PHP 5 and require PHP 7.2 as minimum version.
-
v0.6.019 Oct 2018Release notes
Open source →Changed
- BREAKING CHANGE Changed the constructor function of middleware. From now on you can pass a handler to it's constructor. Handlers are responsible for logging request/responses. Removed threshold argument.
Release notes
Open source →Changed
- BREAKING CHANGE Changed the constructor function of middleware.
- From now on you can pass a handler to it's constructor. Handlers are responsible for logging request/responses.
- Removed threshold argument.
-
v0.5.001 Oct 2018Release notes
Open source →Changed
- BREAKING CHANGE Renamed the variable $logRequestOnExceptionOnly to $onExceptionOnly. The purpose of this constructor argument was to log request and responses only if an exceptgition occurs. If you were manually setting this argument as true now you must set it as false as the variables meaning is inverted.
- Deprecated the option requests. It will be removed on my next version.
Release notes
Open source →Changed
- BREAKING CHANGE Renamed the variable
$logRequestOnExceptionOnlyto$onExceptionOnly. The purpose of this constructor argument was to log request and responses only if an exception occurs. If you were manually setting this argument as true now you must set it as false as the variables meaning is inverted. - Deprecated the option
requests. It will be removed on my next version.
-
v0.4.012 Sep 2018Release notes
Open source →Changed
- Removed
LoggerAwareTrait. Therefore the logger can not be set after the construction of the middleware. - Changed the variable name
$logRequestsof the constructor to$logRequestOnExceptionOnly. - In case a message is not an
\Exceptionor aMessageInterfacean Exception is thrown. - Changed all the functions except of
__constructand__invoketo private. Same for the properties.
- Removed
-
v0.3.023 Aug 2018Release notes
Open source →Changed
- The package was reading the headers of the Request/Response and if they contained
application/jsonthe body was parsed into an array in order to be better readable in the logger. This has changed to match a regular expression/application\/[\w\.\+]*(json)/in order to catch more cases. Thanks @eduarguzher #4 - According to PHPStorm indication the
ext-jsonneeds to be installed in order for the package to work. Therefore it was added as a requirement tocomposer.json
- The package was reading the headers of the Request/Response and if they contained
-
v0.2.024 Jun 2018Release notes
Open source →Added
- A new option is added with key
sensitive. When you make a request using guzzle you can set this option to true in order not to log the body of the request and response. Example:
$guzzle->get('/test', ['log' => ['sensitive' => true]]);Changed
- Changed the required version of guzzle from
^6.3to6.*. Package should be able to work with any version6.*ofguzzle. - For performance reasons when a body of a request/response is bigger than 3500 characters the body is truncated.
When it was truncated a key with
summarywas added in the logs and also a key withbody. Thebodycontained only the wording "Body was truncated because of it's size". This is changed now and thesummarykey is removed and thebodykey will contain the summary from now on. - If a Stream is not seekable or readable the body can not be logged. A wording is added instead in the key
body.
- A new option is added with key
-
v0.1.005 Apr 2016