Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f27c3a8

Browse filesBrowse files
committed
feature #27801 [MonologBridge] Add ProcessorInterface, enabling autoconfiguration of monolog processors (nicolas-grekas)
This PR was merged into the 4.2-dev branch. Discussion ---------- [MonologBridge] Add ProcessorInterface, enabling autoconfiguration of monolog processors | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | symfony/symfony-docs#9996 Using this, enabling e.g. TokenProcessor or WebProcessor just needs one line in `services.yaml`: ```yaml services: Symfony\Bridge\Monolog\Processor\TokenProcessor: ~ Symfony\Bridge\Monolog\Processor\WebProcessor: ~ ``` Commits ------- 28a4912 [MonologBridge] Add ProcessorInterface, enabling autoconfiguration of monolog processors
2 parents 9da0454 + 28a4912 commit f27c3a8
Copy full SHA for f27c3a8

File tree

5 files changed

+35
-2
lines changed
Filter options

5 files changed

+35
-2
lines changed

‎src/Symfony/Bridge/Monolog/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Monolog/CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
4.2.0
5+
-----
6+
7+
* added `ProcessorInterface`: an optional interface to allow autoconfiguration of Monolog processors
8+
49
4.1.0
510
-----
611

+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\Monolog\Processor;
13+
14+
/**
15+
* An optional interface to allow autoconfiguration of Monolog processors.
16+
*
17+
* @author Nicolas Grekas <p@tchwork.com>
18+
*/
19+
interface ProcessorInterface
20+
{
21+
/**
22+
* @return array The processed records
23+
*/
24+
public function __invoke(array $records);
25+
}

‎src/Symfony/Bridge/Monolog/Processor/TokenProcessor.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Monolog/Processor/TokenProcessor.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* @author Dany Maillard <danymaillard93b@gmail.com>
2020
*/
21-
class TokenProcessor
21+
class TokenProcessor implements ProcessorInterface
2222
{
2323
private $tokenStorage;
2424

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Monolog/Processor/WebProcessor.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
* @author Jordi Boggiano <j.boggiano@seld.be>
2323
*/
24-
class WebProcessor extends BaseWebProcessor implements EventSubscriberInterface
24+
class WebProcessor extends BaseWebProcessor implements EventSubscriberInterface, ProcessorInterface
2525
{
2626
public function __construct(array $extraFields = null)
2727
{

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Doctrine\Common\Annotations\Reader;
1515
use Doctrine\Common\Annotations\AnnotationRegistry;
1616
use Symfony\Bridge\Monolog\Processor\DebugProcessor;
17+
use Symfony\Bridge\Monolog\Processor\ProcessorInterface;
1718
use Symfony\Bridge\Twig\Extension\CsrfExtension;
1819
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1920
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
@@ -324,6 +325,8 @@ public function load(array $configs, ContainerBuilder $container)
324325
->addTag('kernel.event_subscriber');
325326
$container->registerForAutoconfiguration(ResettableInterface::class)
326327
->addTag('kernel.reset', array('method' => 'reset'));
328+
$container->registerForAutoconfiguration(ProcessorInterface::class)
329+
->addTag('monolog.processor');
327330
$container->registerForAutoconfiguration(PropertyListExtractorInterface::class)
328331
->addTag('property_info.list_extractor');
329332
$container->registerForAutoconfiguration(PropertyTypeExtractorInterface::class)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.