\Google\AdsApi\CommonGuzzleLogMessageFormatter

Stores and formats logging information about a single Guzzle API call.

Summary

Methods
Properties
Constants
__construct()
formatSummary()
formatDetailed()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
scrubAndFormatDetailedMessage()
$SUMMARY_MESSAGE_FORMAT
$DETAILED_MESSAGE_FORMAT
$REDACTED_DATA_MESSAGE
$requestHttpHeadersToScrub
$additionalSummaryInfo
$shouldLogResponsePayload
$redactedResponsePayloadMessage
$summaryMessageFormatter
$detailedMessageFormatter
N/A

Properties

$SUMMARY_MESSAGE_FORMAT

$SUMMARY_MESSAGE_FORMAT :

Type

$DETAILED_MESSAGE_FORMAT

$DETAILED_MESSAGE_FORMAT :

Type

$REDACTED_DATA_MESSAGE

$REDACTED_DATA_MESSAGE :

Type

$requestHttpHeadersToScrub

$requestHttpHeadersToScrub :

Type

$additionalSummaryInfo

$additionalSummaryInfo :

Type

$shouldLogResponsePayload

$shouldLogResponsePayload :

Type

$redactedResponsePayloadMessage

$redactedResponsePayloadMessage :

Type

$summaryMessageFormatter

$summaryMessageFormatter :

Type

$detailedMessageFormatter

$detailedMessageFormatter :

Type

Methods

__construct()

__construct(array<mixed,string>  $requestHttpHeadersToScrub,array<mixed,string>  $additionalSummaryInfo,boolean  $shouldLogResponsePayload,string|null  $redactedResponsePayloadMessage = null,\GuzzleHttp\MessageFormatter|null  $summaryMessageFormatter = null,\GuzzleHttp\MessageFormatter|null  $detailedMessageFormatter = null)

Creates a new Guzzle log formatter with the specified settings.

Parameters

array<mixed,string> $requestHttpHeadersToScrub

a list of request HTTP headers to scrub

array<mixed,string> $additionalSummaryInfo

an associative array of additional info for formatting a message as summary

boolean $shouldLogResponsePayload

whether the logger should log response payload

string|null $redactedResponsePayloadMessage

the message to be used when the response payload is redacted

\GuzzleHttp\MessageFormatter|null $summaryMessageFormatter

the Guzzle message formatter for summary formatting

\GuzzleHttp\MessageFormatter|null $detailedMessageFormatter

the Guzzle message formatter for detailed formatting

formatSummary()

formatSummary(\Psr\Http\Message\RequestInterface  $request,\Psr\Http\Message\ResponseInterface|null  $response = null): string

Formats this log message as a summary line.

Parameters

\Psr\Http\Message\RequestInterface $request

the HTTP request

\Psr\Http\Message\ResponseInterface|null $response

the HTTP response

Returns

string —

the formatted summary log message

formatDetailed()

formatDetailed(\Psr\Http\Message\RequestInterface  $request,\Psr\Http\Message\ResponseInterface  $response = null,\Exception  $error = null): string

Formats a detailed message based on the specified HTTP request and response, and errors, if present. This function also replaces the original response with a new one with a seekable stream, if the original one contains forward-only stream.

Parameters

\Psr\Http\Message\RequestInterface $request

the HTTP request

\Psr\Http\Message\ResponseInterface $response
\Exception $error

Returns

string —

the formatted detailed log message

scrubAndFormatDetailedMessage()

scrubAndFormatDetailedMessage(\Psr\Http\Message\RequestInterface  $request,\Psr\Http\Message\ResponseInterface|null  $response = null,\Exception  $error = null): string

Scrubs and formats a detailed message containing HTTP request and response, and errors if exist.

Parameters

\Psr\Http\Message\RequestInterface $request

the HTTP request

\Psr\Http\Message\ResponseInterface|null $response

the HTTP response

\Exception $error

the HTTP error

Returns

string —

the formatted detailed log message