\Guzzle\Plugin\LogLogPlugin

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.

Summary

Methods
Properties
Constants
__construct()
getDebugPlugin()
getSubscribedEvents()
onCurlRead()
onCurlWrite()
onRequestBeforeSend()
onRequestSent()
No public properties found
No constants found
No protected methods found
$logAdapter
$formatter
$wireBodies
N/A
No private methods found
No private properties found
N/A

Properties

$formatter

$formatter : \Guzzle\Log\MessageFormatter

Type

\Guzzle\Log\MessageFormatter — Formatter used to format messages before logging

$wireBodies

$wireBodies : boolean

Type

boolean — Whether or not to wire request and response bodies

Methods

__construct()

__construct(\Guzzle\Log\LogAdapterInterface  $logAdapter, string|\Guzzle\Log\MessageFormatter  $formatter = null, boolean  $wireBodies = false) 

Parameters

\Guzzle\Log\LogAdapterInterface $logAdapter

Adapter object used to log message

string|\Guzzle\Log\MessageFormatter $formatter

Formatter used to format log messages or the formatter template

boolean $wireBodies

Set to true to track request and response bodies using a temporary buffer if the bodies are not repeatable.

getDebugPlugin()

getDebugPlugin(boolean  $wireBodies = true, resource  $stream = null) : self

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

Parameters

boolean $wireBodies

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

resource $stream

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

Returns

self

getSubscribedEvents()

getSubscribedEvents() : array

Returns an array of event names this subscriber wants to listen to.

The array keys are event names and the value can be:

  • The method name to call (priority defaults to 0)
  • An array composed of the method name to call and the priority
  • An array of arrays composed of the method names to call and respective priorities, or 0 if unset

For instance:

  • array('eventName' => 'methodName')
  • array('eventName' => array('methodName', $priority))
  • array('eventName' => array(array('methodName1', $priority), array('methodName2')))

Returns

array —

The event names to listen to

onCurlRead()

onCurlRead(\Guzzle\Common\Event  $event) 

Event triggered when curl data is read from a request

Parameters

\Guzzle\Common\Event $event

onCurlWrite()

onCurlWrite(\Guzzle\Common\Event  $event) 

Event triggered when curl data is written to a response

Parameters

\Guzzle\Common\Event $event

onRequestBeforeSend()

onRequestBeforeSend(\Guzzle\Common\Event  $event) 

Called before a request is sent

Parameters

\Guzzle\Common\Event $event

onRequestSent()

onRequestSent(\Guzzle\Common\Event  $event) 

Triggers the actual log write when a request completes

Parameters

\Guzzle\Common\Event $event