Injects url/method and remote IP of the current web request in all records.
More...
Injects url/method and remote IP of the current web request in all records.
- Author
- Jordi Boggiano j.bog.nosp@m.gian.nosp@m.o@sel.nosp@m.d.be
Definition at line 19 of file WebProcessor.php.
◆ __construct()
Monolog\Processor\WebProcessor::__construct |
( |
|
$serverData = null , |
|
|
array |
$extraFields = null |
|
) |
| |
- Parameters
-
array | \ArrayAccess | $serverData | Array or object w/ ArrayAccess that provides access to the $_SERVER data |
array | null | $extraFields | Field names and the related key inside $serverData to be added. If not provided it defaults to: url, ip, http_method, server, referrer |
Definition at line 45 of file WebProcessor.php.
References $_SERVER, Monolog\Processor\WebProcessor\$extraFields, and Monolog\Processor\WebProcessor\$serverData.
52 throw new \UnexpectedValueException(
'$serverData must be an array or object implementing ArrayAccess.');
57 foreach (array_keys($this->extraFields) as $fieldName) {
59 unset($this->extraFields[$fieldName]);
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
◆ __invoke()
Monolog\Processor\WebProcessor::__invoke |
( |
array |
$record | ) |
|
◆ addExtraField()
Monolog\Processor\WebProcessor::addExtraField |
( |
|
$extraName, |
|
|
|
$serverName |
|
) |
| |
- Parameters
-
string | $extraName | |
string | $serverName | |
- Returns
- $this
Definition at line 90 of file WebProcessor.php.
92 $this->extraFields[$extraName] = $serverName;
◆ appendExtraFields()
Monolog\Processor\WebProcessor::appendExtraFields |
( |
array |
$extra | ) |
|
|
private |
- Parameters
-
- Returns
- array
Definition at line 101 of file WebProcessor.php.
Referenced by Monolog\Processor\WebProcessor\__invoke().
103 foreach ($this->extraFields as $extraName => $serverName) {
104 $extra[$extraName] = isset($this->serverData[$serverName]) ? $this->serverData[$serverName] : null;
107 if (isset($this->serverData[
'UNIQUE_ID'])) {
108 $extra[
'unique_id'] = $this->serverData[
'UNIQUE_ID'];
◆ $extraFields
Monolog\Processor\WebProcessor::$extraFields |
|
protected |
◆ $serverData
Monolog\Processor\WebProcessor::$serverData |
|
protected |
The documentation for this class was generated from the following file: