8000 minor #17667 [HttpKernel] Add `#[WithLogLevel]` attribute (alexandre-… · symfony/symfony-docs@c67ed64 · GitHub
[go: up one dir, main page]

Skip to content

Commit c67ed64

Browse files
committed
minor #17667 [HttpKernel] Add #[WithLogLevel] attribute (alexandre-daubois)
This PR was merged into the 6.3 branch. Discussion ---------- [HttpKernel] Add `#[WithLogLevel]` attribute Closes #17658 CI will be solved by #17668 Commits ------- cc8d4ed [HttpKernel] Add #[WithLogLevel] attribute
2 parents 21888e7 + cc8d4ed commit c67ed64

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

reference/configuration/framework.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3642,6 +3642,23 @@ to the ``#[WithHttpStatus]`` attribute on the exception class::
36423642

36433643
The ``#[WithHttpStatus]`` attribute was introduced in Symfony 6.3.
36443644

3645+
It is also possible to map a log level on a custom exception class using
3646+
the ``#[WithLogLevel]`` attribute::
3647+
3648+
namespace App\Exception;
3649+
3650+
use Psr\Log\LogLevel;
3651+
use Symfony\Component\HttpKernel\Attribute\WithLogLevel;
3652+
3653+
#[WithLogLevel(LogLevel::WARNING)]
3654+
class CustomException extends \Exception
3655+
{
3656+
}
3657+
3658+
.. versionadded:: 6.3
3659+
3660+
The ``#[WithLogLevel]`` attribute was introduced in Symfony 6.3.
3661+
36453662
.. _`HTTP Host header attacks`: https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html
36463663
.. _`Security Advisory Blog post`: https://symfony.com/blog/security-releases-symfony-2-0-24-2-1-12-2-2-5-and-2-3-3-released#cve-2013-4752-request-gethost-poisoning
36473664
.. _`PhpStormProtocol`: https://github.com/aik099/PhpStormProtocol

0 commit comments

Comments
 (0)
0