Skip to content

Commit 12d52ea

Browse files
committed
minor #15449 [Logging] Fix incorrect PHP example to exclude HTTP code with Monolog (ker0x)
This PR was merged into the 5.3 branch. Discussion ---------- [Logging] Fix incorrect PHP example to exclude HTTP code with Monolog With the previous example, when running `composer run-script --no-dev post-install-cmd` we get the following error: ```bash Executing script cache:clear [KO] [KO] Script cache:clear returned with error code 1 !! !! In FileLoader.php line 174: !! !! The following keys are not supported by "Symfony\Config\Monolog\HandlerConf !! ig\ExcludedHttpCodeConfig": 0, 1 in /home/ker0x/dev/imdb/config/packages/pr !! od/monolog.php (which is being imported from "/home/ker0x/dev/imdb/src/Kern !! el.php"). !! !! !! In ExcludedHttpCodeConfig.php line 57: !! !! The following keys are not supported by "Symfony\Config\Monolog\HandlerConf !! ig\ExcludedHttpCodeConfig": 0, 1 !! !! !! Script `@auto`-scripts was called via post-install-cmd ``` Commits ------- 74b6cf6 Fix incorrect PHP example to exclude HTTP code with Monolog
2 parents 7a290e7 + 74b6cf6 commit 12d52ea

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

logging/monolog_exclude_http_codes.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@ logging these HTTP codes based on the MonologBundle configuration:
5252
use Symfony\Config\MonologConfig;
5353
5454
return static function (MonologConfig $monolog) {
55-
$monolog->handler('main')
55+
$mainHandler = $monolog->handler('main')
5656
// ...
5757
->type('fingers_crossed')
5858
->handler(...)
59-
->excludedHttpCode([403, 404])
6059
;
60+
61+
$mainHandler->excludedHttpCode()->code(403);
62+
$mainHandler->excludedHttpCode()->code(404);
6163
};
6264
6365
.. caution::

0 commit comments

Comments
 (0)