8000 [MonologBridge] Added WebSubscriberProcessor to ease processor configuration by lyrixx · Pull Request #26832 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[MonologBridge] Added WebSubscriberProcessor to ease processor configuration #26832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[MonologBridge] Added WebSubscriberProcessor to ease processor config…
…uration
  • Loading branch information
lyrixx committed Apr 23, 2018
commit b1287d65d3f4a2fec732e641a44ef314fb3190d0
5 changes: 5 additions & 0 deletions src/Symfony/Bridge/Monolog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

4.1.0
-----

* `WebProcessor` now implements `EventSubscriberInterface` in order to be easily autoconfigured

4.0.0
-----

Expand Down
11 changes: 10 additions & 1 deletion src/Symfony/Bridge/Monolog/Processor/WebProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
namespace Symfony\Bridge\Monolog\Processor;

use Monolog\Processor\WebProcessor as BaseWebProcessor;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;

/**
* WebProcessor override to read from the HttpFoundation's Request.
*
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class WebProcessor extends BaseWebProcessor
class WebProcessor extends BaseWebProcessor implements EventSubscriberInterface
{
public function __construct(array $extraFields = null)
{
Expand All @@ -34,4 +36,11 @@ public function onKernelRequest(GetResponseEvent $event)
$this->serverData['REMOTE_ADDR'] = $event->getRequest()->getClientIp();
}
}

public static function getSubscribedEvents()
{
return array(
KernelEvents::REQUEST => array('onKernelRequest', 4096),
);
}
}
0