WebProcessor
in package
implements
ProcessorInterface
Injects url/method and remote IP of the current web request in all records
Tags
Table of Contents
Interfaces
- ProcessorInterface
- An optional interface to allow labelling Monolog processors.
Properties
- $extraFields : array<string|int, mixed>
- Default fields
- $serverData : array<string|int, mixed>|ArrayAccess
Methods
- __construct() : mixed
- __invoke() : array<string|int, mixed>
- addExtraField() : $this
- appendExtraFields() : array<string|int, mixed>
Properties
$extraFields
Default fields
protected
array<string|int, mixed>
$extraFields
= array('url' => 'REQUEST_URI', 'ip' => 'REMOTE_ADDR', 'http_method' => 'REQUEST_METHOD', 'server' => 'SERVER_NAME', 'referrer' => 'HTTP_REFERER')
Array is structured as [key in record.extra => key in $serverData]
$serverData
protected
array<string|int, mixed>|ArrayAccess
$serverData
Methods
__construct()
public
__construct([array<string|int, mixed>|ArrayAccess $serverData = null ][, array<string|int, mixed>|null $extraFields = null ]) : mixed
Parameters
- $serverData : array<string|int, mixed>|ArrayAccess = null
-
Array or object w/ ArrayAccess that provides access to the $_SERVER data
- $extraFields : array<string|int, mixed>|null = null
-
Field names and the related key inside $serverData to be added. If not provided it defaults to: url, ip, http_method, server, referrer
__invoke()
public
__invoke(array<string|int, mixed> $record) : array<string|int, mixed>
Parameters
- $record : array<string|int, mixed>
Return values
array<string|int, mixed>addExtraField()
public
addExtraField(string $extraName, string $serverName) : $this
Parameters
- $extraName : string
- $serverName : string
Return values
$thisappendExtraFields()
private
appendExtraFields(array<string|int, mixed> $extra) : array<string|int, mixed>
Parameters
- $extra : array<string|int, mixed>