Skip to content

v0.3.0

Choose a tag to compare

@azim-kordpour azim-kordpour released this 25 Sep 13:02
· 2 commits to main since this release

Added

  • Logging for Laravel's Http facade (and any Guzzle client) with the HttpLogger::middleware()
    Guzzle middleware: register it globally (Http::globalMiddleware(...)) or per client
    (Http::withMiddleware(...)), add properties per middleware or per call (log_context option),
    and adjust options such as messages. Logs requests, responses, connection failures (including
    async and pooled requests and handlers that throw), retries and redirects, shares the trace id
    with incoming requests, and logs once even if registered twice.

Security

  • Fixed: the first query parameter of a URL inside free text (e.g. the URL Guzzle appends to
    connection errors: ... for https://host/?api_key=...) was not masked since 0.2.0.

Usage:

Http::globalMiddleware(HttpLogger::middleware());                          // every Http:: call

Http::withMiddleware(HttpLogger::middleware(['supplier' => 'ratehawk']))   // some calls
    ->withOptions(['log_context' => ['action' => 'book']])                 // per call
    ->post($url, $payload);

Upgrading from 0.2.0 is recommended because of the masking fix above.

Full changelog: v0.2.0...v0.3.0