[FrameworkBundle][HttpKernel] Feat/add exception.x.log channel

by @Arkalo2

Some issues have been detected in this pull request

Issues that can be fixed by applying a patch

Review the proposed patch then download it to apply it manually or execute the following command from the repository root directory:

curl https://fabbot.io/patch/symfony/symfony/57309/90b01f2a447c165fd7c85eb50df00efaf7d76cd7/cs.diff | patch -p0
diff -ru src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
--- src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php	2024-06-08 21:52:07.003444410 +0000
+++ src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php	2024-06-08 21:54:51.530214414 +0000
@@ -388,7 +388,7 @@
             }
             $loggers[$exception['log_channel']] = new Reference(sprintf('monolog.logger.%s', $exception['log_channel']));
         }
-        
+
         $exceptionListener
             ->replaceArgument(3, $config['exceptions'])
             ->replaceArgument(4, $loggers)
diff -ru src/Symfony/Component/HttpKernel/EventListener/ErrorListener.php src/Symfony/Component/HttpKernel/EventListener/ErrorListener.php
--- src/Symfony/Component/HttpKernel/EventListener/ErrorListener.php	2024-06-08 21:52:07.569464260 +0000
+++ src/Symfony/Component/HttpKernel/EventListener/ErrorListener.php	2024-06-08 21:54:55.408350421 +0000
@@ -164,12 +164,12 @@
     protected function logException(\Throwable $exception, string $message, ?string $logLevel = null, ?string $logChannel = null): void
     {
         $logLevel ??= $this->resolveLogLevel($exception);
-        
+
         $logChannel ??= $this->resolveLogChannel($exception);
-        
+
         $logger = $this->getLogger($logChannel);
-        
-        if(null === $logger) {
+
+        if (null === $logger) {
             return;
         }
 
diff -ru src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php
--- src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php	2024-06-08 21:52:07.767471204 +0000
+++ src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php	2024-06-08 21:55:00.692535739 +0000
@@ -143,7 +143,6 @@
         $this->assertCount(1, $logger->getLogs('warning'));
     }
 
-
     public function testHandleWithLogChannel()
     {
         $request = new Request();
@@ -162,7 +161,7 @@
                 'log_level' => 'error',
                 'status_code' => 402,
             ],
-        ], ['channel' => $channelLoger,]);
+        ], ['channel' => $channelLoger]);
 
         $l->logKernelException($event);
         $l->onKernelException($event);
@@ -190,7 +189,7 @@
                 'status_code' => 402,
                 'log_channel' => 'channel',
             ],
-        ], ['channel' => $channelLoger,]);
+        ], ['channel' => $channelLoger]);
         $l->logKernelException($event);
         $l->onKernelException($event);
 

0
Common Typos

0
License Headers

0
Pull Request Contributor Headers

0
File Permissions

0
Merge Commits

0
Exception Messages Formatting

0
Usage of void in test files

0
Use ::class whenever possible

0
Deprecation Messages