Composable Commerce PHP SDKPHP SDK
  • Namespace
  • Class
  • Tree

Namespaces

  • Commercetools
    • Commons
      • Helper
    • Core
      • Builder
        • Request
        • Update
      • Cache
      • Client
        • Adapter
        • OAuth
      • Error
      • Helper
        • Annotate
        • State
          • Renderer
        • Subscriber
          • Log
      • Model
        • ApiClient
        • Cart
        • CartDiscount
        • Category
        • Channel
        • Common
        • Customer
        • CustomerGroup
        • CustomField
        • CustomObject
        • DiscountCode
        • Extension
        • Inventory
        • Message
        • Order
        • OrderEdit
        • Payment
        • Product
          • Search
        • ProductDiscount
        • ProductSelection
        • ProductType
        • Project
        • Review
        • ShippingMethod
        • ShoppingList
        • State
        • Store
        • Subscription
        • TaxCategory
        • Type
        • Zone
      • Request
        • ApiClients
        • CartDiscounts
          • Command
        • Carts
          • Command
        • Categories
          • Command
        • Channels
          • Command
        • CustomerGroups
          • Command
        • Customers
          • Command
        • CustomField
          • Command
        • CustomObjects
        • DiscountCodes
          • Command
        • Extensions
          • Command
        • GraphQL
        • InStores
        • Inventory
          • Command
        • Me
          • Command
        • Messages
        • OrderEdits
          • Command
          • StagedOrder
            • Command
        • Orders
          • Command
        • Payments
          • Command
        • ProductDiscounts
          • Command
        • Products
          • Command
        • ProductSelections
          • Command
        • ProductTypes
          • Command
        • Project
          • Command
        • Query
        • Reviews
          • Command
        • ShippingMethods
          • Command
        • ShoppingLists
          • Command
        • States
          • Command
        • Stores
          • Command
        • Subscriptions
          • Command
        • TaxCategories
          • Command
        • Types
          • Command
        • Zones
          • Command
      • Response

Classes

  • Formatter
  • LogSubscriber
  • SimpleLogger

Class Formatter

Formats log messages using variable substitutions for requests, responses, and other transactional data.

The following variable substitutions are supported:

  • {request}: Full HTTP request message
  • {response}: Full HTTP response message
  • {ts}: Timestamp
  • {host}: Host of the request
  • {method}: Method of the request
  • {url}: URL of the request
  • {host}: Host of the request
  • {protocol}: Request protocol
  • {version}: Protocol version
  • {resource}: Resource of the request (path + query + fragment)
  • {hostname}: Hostname of the machine that sent the request
  • {code}: Status code of the response (if available)
  • {phrase}: Reason phrase of the response (if available)
  • {error}: Any error messages (if available)
  • {req_header_*}: Replace * with the lowercased name of a request header to add to the message
  • {res_header_*}: Replace * with the lowercased name of a response header to add to the message
  • {req_headers}: Request headers
  • {res_headers}: Response headers
  • {req_body}: Request body
  • {res_body}: Response body
Namespace: Commercetools\Core\Helper\Subscriber\Log
Located at Core/Helper/Subscriber/Log/Formatter.php

Methods summary

public
# __construct( string $template = self::CLF )

Parameters

$template
Log message template
public string
# format( GuzzleHttp\Message\RequestInterface $request, GuzzleHttp\Message\ResponseInterface $response = null, Exception $error = null, array $customData = [] )

Returns a formatted message

Returns a formatted message

Parameters

$request
Request that was sent
$response
Response that was received
$error
Exception that was received
$customData
Associative array of custom template data

Returns

string

Constants summary

string CLF

Apache Common Log Format.

Apache Common Log Format.

Link

http://httpd.apache.org/docs/1.3/logs.html#common
# "{hostname} {req_header_User-Agent} - [{ts}] \"{method} {resource} {protocol}/{version}\" {code} {res_header_Content-Length}"
string DEBUG

phpcs:enable

phpcs:enable

# ">>>>>>>>\n{request}\n<<<<<<<<\n{response}\n--------\n{error}"
string SHORT
# '[{ts}] "{method} {resource} {protocol}/{version}" {code}'
PHP SDK API documentation generated by ApiGen