Skip to content

feat: console.interactive_only flag #504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Bundle\MonologBundle\DependencyInjection;

use Composer\InstalledVersions;
use Monolog\Logger;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
Expand Down Expand Up @@ -40,6 +41,7 @@
* - [level]: level name or int value, defaults to DEBUG
* - [bubble]: bool, defaults to true
* - [console_formatter_options]: array
* - [interactive_only]: bool, defaults to false
*
* - firephp:
* - [level]: level name or int value, defaults to DEBUG
Expand Down Expand Up @@ -448,6 +450,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->scalarNode('priority')->defaultValue(0)->end()
->scalarNode('level')->defaultValue('DEBUG')->end()
->booleanNode('bubble')->defaultTrue()->end()
->booleanNode('interactive_only')->defaultFalse()->end()
->scalarNode('app_name')->defaultNull()->end()
->booleanNode('fill_extra_context')->defaultFalse()->end() // sentry
->booleanNode('include_stacktraces')->defaultFalse()->end()
Expand Down Expand Up @@ -796,6 +799,10 @@ public function getConfigTreeBuilder(): TreeBuilder
->ifTrue(function ($v) { return 'server_log' === $v['type'] && empty($v['host']); })
->thenInvalid('The host has to be specified to use a ServerLogHandler')
->end()
->validate()
->ifTrue(function ($v) { return $v['interactive_only'] && version_compare(InstalledVersions::getVersion('symfony/monolog-bridge'), '7.3.0', '<'); })
->thenInvalid('The interactive_only flag is available with symfony/monolog-bridge 7.3.0 or higher')
->end()
;

return $treeBuilder;
Expand Down
1 change: 1 addition & 0 deletions DependencyInjection/MonologExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
$handler['bubble'],
$handler['verbosity_levels'] ?? [],
$handler['console_formatter_options'],
$handler['interactive_only'],
]);
$definition->addTag('kernel.event_subscriber');
break;
Expand Down
1 change: 1 addition & 0 deletions Resources/config/schema/monolog-1.0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<xsd:attribute name="priority" type="xsd:integer" />
<xsd:attribute name="level" type="level" />
<xsd:attribute name="bubble" type="xsd:boolean" />
<xsd:attribute name="interactive-only" type="xsd:boolean" />
<xsd:attribute name="process-psr-3-messages" type="xsd:boolean" />
<xsd:attribute name="use_locking" type="xsd:boolean" />
<xsd:attribute name="app-name" type="xsd:string" />
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
],
"require": {
"php": ">=7.2.5",
"composer-runtime-api": "^2.0",
"symfony/monolog-bridge": "^5.4 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
"symfony/config": "^5.4 || ^6.0 || ^7.0",
Expand Down
Loading