guzzle-log-middleware

A Guzzle middleware to log request and responses automatically

MIT License

Downloads
1.3M
Stars
73
Committers
6

Bot releases are visible (Hide)

guzzle-log-middleware - Allow psr/log in version 2 and 3 Latest Release

Published by gmponos over 2 years ago

guzzle-log-middleware - v2.1.0

Published by gmponos over 2 years ago

Changes

  • Allow PHP 8
  • Fix a deprecation on MultiRecordArrayHandler regarding query
guzzle-log-middleware -

Published by gmponos over 4 years ago

Changed

  • [BC] Changed the signature of HandlerInterface::log to 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
guzzle-log-middleware -

Published by gmponos about 5 years ago

Added

  • Added parameters in MultiRecordArrayHandler in order to customize the size truncated #25
  • MultiRecordArrayHandler will parse form requests as and log them as array #27
guzzle-log-middleware -

Published by gmponos over 5 years ago

Changes

  • Fixes #24. Body MUST rewind on huge responses.
guzzle-log-middleware - First stable release!!

Published by gmponos almost 6 years ago

Changes

  • Added more classes of status codes to ThresholdStrategy
guzzle-log-middleware -

Published by gmponos almost 6 years ago

Changes

  • Set as the default strategy in all handlers the FixedStrategy

BREAKING CHANGES

  • LogLevelStrategy class is removed and it has been separated to smaller classes.
    Check the added section below.
  • Changed the namespaces completely. The new Namespace is GuzzleLogMiddleware instead of Gmponos\GuzzleLogger.
    Check the README file for instructions.
  • Changed the signature of function HandlerInterface::log.
  • Changed ArrayHandler to MultiRecordArrayHandler

Added

  • FixedStrategy a strategy that you are able to set one level for all your logs.
  • ThresholdLevelStrategy a strategy that works with thresholds depending on the status code.
  • StatusCodeStrategy a strategy that you are able to set a specific log level per status code.
guzzle-log-middleware -

Published by gmponos almost 6 years ago

Changed

  • BREAKING CHANGE Dropped support for PHP 5 and require PHP 7.2 as minimum version.
guzzle-log-middleware -

Published by gmponos about 6 years ago

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.
guzzle-log-middleware - v0.5.0

Published by gmponos about 6 years ago

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.
guzzle-log-middleware - v0.4.0

Published by gmponos about 6 years ago

Changed

  • Removed LoggerAwareTrait. Therefore the logger can not be set after the construction of the middleware.
  • Changed the variable name $logRequests of the constructor to $logRequestOnExceptionOnly.
  • In case a message is not an \Exception or a MessageInterface an Exception is thrown.
  • Changed all the functions except of __construct and __invoke to private. Same for the properties.
guzzle-log-middleware -

Published by gmponos about 6 years ago

Changed

  • The package was reading the headers of the Request/Response and if they contained application/json the 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-json needs to be installed in order for the package to work. Therefore
    it was added as a requirement to composer.json
guzzle-log-middleware - v0.2.0

Published by gmponos over 6 years ago

0.2.0 - 2018-06-24

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.3 to 6.*. Package should be able to work without constraints.
  • For performance reasons when a body of a request/response is bigger than 3500 characters the body is truncated.
    Before a key with summary was added in the logs and also a key with body. The body contained the wording
    "Body was truncated because of it's size". This is changed now and the summary key is removed therefore the body
    key 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.
guzzle-log-middleware - v0.1.0

Published by gmponos over 6 years ago

I saw on packagist that this package lately has 2000 downloads.

Although they are not so many I thought that it deserves a release to be tagged if someone wants to lock on the current release.

I will soon make big changes to the package.