8000 [MonologBridge] Added WebSubscriberProcessor to ease processor config… · symfony/symfony@99ea4be · GitHub
[go: up one dir, main page]

Skip to content

Commit 99ea4be

Browse files
committed
[MonologBridge] Added WebSubscriberProcessor to ease processor configuration
1 parent a726f05 commit 99ea4be

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/Symfony/Bridge/Monolog/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
4.1.0
5+
-----
6+
7+
* `EventSubscriberInterface` now implements EventSubscriberInterface in order
8+
to be easily autoconfigured
9+
410
4.0.0
511
-----
612

src/Symfony/Bridge/Monolog/Processor/WebProcessor.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@
1212
namespace Symfony\Bridge\Monolog\Processor;
1313

1414
use Monolog\Processor\WebProcessor as BaseWebProcessor;
15+
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1516
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
17+
use Symfony\Component\HttpKernel\KernelEvents;
1618

1719
/**
1820
* WebProcessor override to read from the HttpFoundation's Request.
1921
*
2022
* @author Jordi Boggiano <j.boggiano@seld.be>
2123
*/
22-
class WebProcessor extends BaseWebProcessor
24+
class WebProcessor extends BaseWebProcessor implements EventSubscriberInterface
2325
{
2426
public function __construct(array $extraFields = null)
2527
{
@@ -34,4 +36,11 @@ public function onKernelRequest(GetResponseEvent $event)
3436
$this->serverData['REMOTE_ADDR'] = $event->getRequest()->getClientIp();
3537
}
3638
}
39+
40+
public static function getSubscribedEvents()
41+
{
42+
return array(
43+
KernelEvents::REQUEST => array('onKernelRequest', 4096),
44+
);
45+
}
3746
}

0 commit comments

Comments
 (0)
0