Documentation

WebProcessor
in package
implements ProcessorInterface

Injects url/method and remote IP of the current web request in all records

Tags
author

Jordi Boggiano j.boggiano@seld.be

Interfaces, Classes and Traits

ProcessorInterface
An optional interface to allow labelling Monolog processors.

Table of Contents

$extraFields  : array<string, string>
Default fields
$serverData  : array<string, mixed>|ArrayAccess<string, mixed>
__construct()  : mixed
__invoke()  : array<string|int, mixed>
addExtraField()  : self
appendExtraFields()  : array<string|int, mixed>

Properties

$extraFields

Default fields

protected array<string, string> $extraFields = ['url' => 'REQUEST_URI', 'ip' => 'REMOTE_ADDR', 'http_method' => 'REQUEST_METHOD', 'server' => 'SERVER_NAME', 'referrer' => 'HTTP_REFERER', 'user_agent' => 'HTTP_USER_AGENT']

Array is structured as [key in record.extra => key in $serverData]

$serverData

protected array<string, mixed>|ArrayAccess<string, mixed> $serverData

Methods

__construct()

public __construct([array<string, mixed>|ArrayAccess<string, mixed>|null $serverData = null ][, array<string, string>|array<string|int, string>|null $extraFields = null ]) : mixed
Parameters
$serverData : array<string, mixed>|ArrayAccess<string, mixed>|null = null

Array or object w/ ArrayAccess that provides access to the $_SERVER data

$extraFields : array<string, string>|array<string|int, string>|null = null

Field names and the related key inside $serverData to be added (or just a list of field names to use the default configured $serverData mapping). If not provided it defaults to: [url, ip, http_method, server, referrer] + unique_id if present in server data

Return values
mixed

__invoke()

public __invoke(array<string|int, mixed> $record) : array<string|int, mixed>
Parameters
$record : array<string|int, mixed>
Return values
array<string|int, mixed>

The processed record

addExtraField()

public addExtraField(string $extraName, string $serverName) : self
Parameters
$extraName : string
$serverName : string
Return values
self

appendExtraFields()

private appendExtraFields(array<string|int, mixed> $extra) : array<string|int, mixed>
Parameters
$extra : array<string|int, mixed>
Return values
array<string|int, mixed>

Search results