WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

YoastSEO_Vendor\GuzzleHttp

Middleware::log() public Yoast 1.0

Middleware that logs requests, responses, and errors using a message formatter.

{} Это метод класса: Middleware{}

Хуков нет.

Возвращает

callable. Returns a function that accepts the next handler.

Использование

$result = Middleware::log( \YoastSEO_Vendor\Psr\Log\LoggerInterface $logger, \YoastSEO_Vendor\GuzzleHttp\MessageFormatter $formatter, $logLevel );
$logger(Loggerчислоerface) (обязательный)
Logs messages.
$formatter(MessageFormatter) (обязательный)
Formatter used to create message strings.
$logLevel(строка)
Level at which to log requests.
По умолчанию: \YoastSEO_Vendor\Psr\Log\LogLevel::INFO

Код Middleware::log() Yoast 15.6.2

<?php
public static function log(\YoastSEO_Vendor\Psr\Log\LoggerInterface $logger, \YoastSEO_Vendor\GuzzleHttp\MessageFormatter $formatter, $logLevel = \YoastSEO_Vendor\Psr\Log\LogLevel::INFO)
{
    return function (callable $handler) use($logger, $formatter, $logLevel) {
        return function ($request, array $options) use($handler, $logger, $formatter, $logLevel) {
            return $handler($request, $options)->then(function ($response) use($logger, $request, $formatter, $logLevel) {
                $message = $formatter->format($request, $response);
                $logger->log($logLevel, $message);
                return $response;
            }, function ($reason) use($logger, $request, $formatter) {
                $response = $reason instanceof \YoastSEO_Vendor\GuzzleHttp\Exception\RequestException ? $reason->getResponse() : null;
                $message = $formatter->format($request, $response, $reason);
                $logger->notice($message);
                return \YoastSEO_Vendor\GuzzleHttp\Promise\rejection_for($reason);
            });
        };
    };
}