8000 feature #26832 [MonologBridge] Added WebSubscriberProcessor to ease p… · symfony/symfony@9ae116f · GitHub
[go: up one dir, main page]

Skip to content

Commit 9ae116f

Browse files
committed
feature #26832 [MonologBridge] Added WebSubscriberProcessor to ease processor configuration (lyrixx)
This PR was merged into the 4.1-dev branch. Discussion ---------- [MonologBridge] Added WebSubscriberProcessor to ease processor configuration | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | --- Side note: I could be nice to have an interface to act as the marker to AutoConfigure processors Commits ------- b1287d6 [MonologBridge] Added WebSubscriberProcessor to ease processor configuration
2 parents 2ed0c67 + b1287d6 commit 9ae116f

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/Symfony/Bridge/Monolog/CHANGELOG.md

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

4+
4.1.0
5+
-----
6+
7+
* `WebProcessor` now implements `EventSubscriberInterface` in order to be easily autoconfigured
8+
49
4.0.0
510
-----
611

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