zendframework/zf2 — pull request #2727 by stefankleff (2012-10-10 11:42:45+00:00)
Title: Added ability to add additional information to the logs via processors.

With processors logs can be enhanced with additional information.
The are called from the logger before the event is passed to the writers and have access to the event array to add any kind of information.

I included two processors in this PR

Backtrace processor to include backtraces in the logs.
```php
$logger->addProcessor(new Processors\Backtrace());
```
will add backtrace information about the class which had triggered the logging. Result
```php
$event = array(
[...]
'extras' => array(
[...]
'file' => 'SomeFile.php',
'line' => 1337,
'class' => 'Foo\MyClass',
'function' => 'myMethod'
)
);
```

Requestid processor to include a unique id per request in the logs.
```php
$logger->addProcessor(new Processors\RequestId());
```
Often it is useful to know which log entries belong to a specific request to filter the logfile later on. This Processor generates a md5 hash based on request time and remote address and add this information to the log event. (Inspired by Ben Waines talk on PHPNW https://joind.in/7003)
```php
$event = array(
[...]
'extras' => array(
[...]
'requestId' => 'SomeMd5Hash'
),
);
```