Skip to content

Commit f27c3a8

Browse 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

File tree

5 files changed

+35
-2
lines changed

5 files changed

+35
-2
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.2.0
5+
-----
6+
7+
* added `ProcessorInterface`: an optional interface to allow autoconfiguration of Monolog processors
8+
49
4.1.0
510
-----
611

Lines 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

Lines 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

Lines 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

Lines 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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy