Class Guzzle\Plugin\Log\LogPlugin

InheritanceGuzzle\Plugin\Log\LogPlugin
ImplementsSymfony\Component\EventDispatcher\EventSubscriberInterface

Plugin class that will add request and response logging to an HTTP request.

The log plugin uses a message formatter that allows custom messages via template variable substitution.

See also \Guzzle\Plugin\Log\MessageLogger for a list of available log template variable substitutions.

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$formatter Guzzle\Log\MessageFormatter Formatter used to format messages before logging Guzzle\Plugin\Log\LogPlugin
$logAdapter Guzzle\Log\LogAdapterInterface Adapter responsible for writing log data Guzzle\Plugin\Log\LogPlugin
$wireBodies bool Whether or not to wire request and response bodies Guzzle\Plugin\Log\LogPlugin

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Guzzle\Plugin\Log\LogPlugin
getDebugPlugin() Get a log plugin that outputs full request, response, and curl error information to stderr Guzzle\Plugin\Log\LogPlugin
getSubscribedEvents() Guzzle\Plugin\Log\LogPlugin
onCurlRead() Event triggered when curl data is read from a request Guzzle\Plugin\Log\LogPlugin
onCurlWrite() Event triggered when curl data is written to a response Guzzle\Plugin\Log\LogPlugin
onRequestBeforeSend() Called before a request is sent Guzzle\Plugin\Log\LogPlugin
onRequestSent() Triggers the actual log write when a request completes Guzzle\Plugin\Log\LogPlugin

Property Details

$formatter protected property

Formatter used to format messages before logging

$logAdapter protected property

Adapter responsible for writing log data

$wireBodies protected property

Whether or not to wire request and response bodies

protected bool $wireBodies null

Method Details

__construct() public method

public void __construct ( Guzzle\Log\LogAdapterInterface $logAdapter, $formatter null, $wireBodies false )
$logAdapter Guzzle\Log\LogAdapterInterface

Adapter object used to log message

$formatter string|Guzzle\Log\MessageFormatter

Formatter used to format log messages or the formatter template

$wireBodies bool

Set to true to track request and response bodies using a temporary

                                       buffer if the bodies are not repeatable.
getDebugPlugin() public static method

Get a log plugin that outputs full request, response, and curl error information to stderr

public static self getDebugPlugin ( $wireBodies true, $stream null )
$wireBodies bool

Set to false to disable request/response body output when they use are not repeatable

$stream resource

Stream to write to when logging. Defaults to STDERR when it is available

getSubscribedEvents() public static method

public static void getSubscribedEvents ( )
onCurlRead() public method

Event triggered when curl data is read from a request

public void onCurlRead ( Guzzle\Common\Event $event )
$event Guzzle\Common\Event
onCurlWrite() public method

Event triggered when curl data is written to a response

public void onCurlWrite ( Guzzle\Common\Event $event )
$event Guzzle\Common\Event
onRequestBeforeSend() public method

Called before a request is sent

public void onRequestBeforeSend ( Guzzle\Common\Event $event )
$event Guzzle\Common\Event
onRequestSent() public method

Triggers the actual log write when a request completes

public void onRequestSent ( Guzzle\Common\Event $event )
$event Guzzle\Common\Event