edr/http-logging-client

Logs to a PSR3-compliant logger when requests/responses are sent through an httplug HTTP client

dev-master 2016-08-25 09:22 UTC

This package is not auto-updated.

Last update: 2024-04-27 17:20:34 UTC


README

An HTTPlug client that logs to a PSR3 logger.

This performs the same function as the HTTPlug plugin. This can be used as an alternative if you need more control of the logging options.

Example usage with Guzzle and Monolog:

$client = new \edr\LoggingHttpClient\LoggingHttpClient(
    new \Http\Adapter\Guzzle6\Client(new \GuzzleHttp\Client()),
    new \Monolog\Logger('debug', new \Monolog\Handler\StreamHandler('/tmp/debug.log')),
    new \edr\LoggingHttpClient\DiactorosFormatter()
);

$client->sendRequest( ... );