Logging uses the PHP-HTTP logger plugin with a PSR-3 logger.
SDK authors can configure logging from the Api class:
$this->logger($logger);SDK users can also configure logging through setup():
$api->setup()->logger($logger);The logger plugin can receive a custom formatter.
$this
->logger($logger)
->formatter($formatter);The formatter is passed directly to the HTTPlug logger plugin.
When cache and logging are both configured, cache activity is also logged through the cache plugin listener.
$this
->cache($pool)
->defaultTtl(3600);
$this->logger($logger);The cache listener logs:
HTTP cache hit:when a cached response is reused.HTTP response cached:when a response is stored.
The log context includes the cache key and, when available, the cache expiration date.
The logger plugin runs at priority 10, after cache.
That means the cache plugin can serve cached responses before the request reaches later plugins. Cache-specific logging is handled by the cache listener instead of relying only on the logger plugin.
See Plugins for the full internal plugin order.