Skip to content

Releases

v0.4.0

Choose a tag to compare

@azim-kordpour azim-kordpour released this 01 Oct 12:58

Added

  • Laravel 13 support.

Removed

  • Laravel 11 support. The package now requires Laravel 12 or 13.

Requirements: PHP 8.2+ and Laravel 12 or 13 (Laravel 13 needs PHP 8.3+).

Upgrading: no code changes are needed. Because this release drops Laravel 11, ^0.3 will not pick it up; update your constraint:

"milzer/laravel-http-logger": "^0.4"

Full changelog: v0.3.0...v0.4.0

v0.3.0

Choose a tag to compare

@azim-kordpour azim-kordpour released this 25 Sep 13:02

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

v0.2.0

Choose a tag to compare

@azim-kordpour azim-kordpour released this 25 Sep 09:54

Security

  • Failure entries and the logger's own error entry log a masked error block (type, message,
    file, line, trace, previous) instead of the raw exception, whose message can contain URLs with
    API keys (Guzzle appends the request URL, query string included).
  • Multipart fields with nested names (payment.card_number, payment[card_number]) are masked
    when any name segment is sensitive.
  • Sensitive XML elements are masked even when they contain child elements.
  • Credentials in URLs (https://user:pass@host) and free-text key=value pairs are masked in raw
    text.
  • Masking fails closed: if a pattern cannot run on a body, the body is replaced by a placeholder
    instead of being logged unmasked.
  • Incoming bodies are no longer read in full before the size check: Content-Length is checked
    first, otherwise the body is read only up to the limit. Multipart summaries stay within
    max_body_bytes as a whole.

Added

  • log.exception_object option to also pass the raw exception object (unmasked) to the logger,
    e.g. for error-reporting tools.

Changed

  • outgoing-failure entries and "http-logger failed to write a log entry" entries no longer
    contain the exception object by default; use the new error block, or enable
    log.exception_object.

Upgrade note: failure entries no longer include the raw exception object by default. If an error-reporting tool relies on it, set log.exception_object to true.

Full changelog: v0.1.0...v0.2.0

First draft

Choose a tag to compare

@azim-kordpour azim-kordpour released this 24 Sep 13:13
Rename to milzer/laravel-http-logger and log incoming requests

- Package renamed to milzer/laravel-http-logger (namespace Milzer\HttpLogger);
  Laravel 11/12 is required, Saloon stays optional for outgoing logging
- Split into Core, Saloon, Laravel and Storage
- LogIncomingRequests middleware: incoming request/response entries with route,
  IP, user id, multipart summaries, streamed/download responses, exclusions and
  a ProvidesIncomingLogContext resolver
- Shared trace id across incoming requests, outgoing Saloon calls and
  dispatched jobs via Laravel Context (reuses a safe X-Request-Id)
- Entries are built and written after the response is sent (in order);
  immediately in console and queue workers
- Large bodies stored in full (masked) on a Laravel disk in per-day folders,
  referenced as body_file; http-logger:prune command with retention days
- direction, trace_id and occurred_at on every entry; configurable
  incoming-*/outgoing-* messages
- Shorter, example-driven README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>