Documentation

BackoffLogger
in package
implements EventSubscriberInterface

Logs backoff retries triggered from the BackoffPlugin

Format your log messages using a template that can contain template substitutions found in MessageFormatter. In addition to the default template substitutions, there is also:

  • retries: The number of times the request has been retried
  • delay: The amount of time the request is being delayed

Table of Contents

Interfaces

EventSubscriberInterface
An EventSubscriber knows himself what events he is interested in.

Constants

DEFAULT_FORMAT  = '[{ts}] {method} {url} - {code} {phrase} - Retries: {retries}, Delay: {delay}, Time: {connect_time}, {total_time}, cURL: {curl_code} {curl_error}'

Properties

$formatter  : MessageFormatter
$logger  : LogAdapterInterface

Methods

__construct()  : mixed
getSubscribedEvents()  : array<string|int, mixed>
Returns an array of event names this subscriber wants to listen to.
onRequestRetry()  : mixed
Called when a request is being retried
setTemplate()  : self
Set the template to use for logging

Constants

DEFAULT_FORMAT

public string DEFAULT_FORMAT = '[{ts}] {method} {url} - {code} {phrase} - Retries: {retries}, Delay: {delay}, Time: {connect_time}, {total_time}, cURL: {curl_code} {curl_error}'

Default log message template

Properties

Methods

getSubscribedEvents()

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

public static getSubscribedEvents() : array<string|int, mixed>

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')))
Return values
array<string|int, mixed>

The event names to listen to

onRequestRetry()

Called when a request is being retried

public onRequestRetry(Event $event) : mixed
Parameters
$event : Event

Event emitted

setTemplate()

Set the template to use for logging

public setTemplate(string $template) : self
Parameters
$template : string

Log message template

Return values
self

        
On this page

Search results