Skip to content

Add enabled parameter in configuration #482

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

Conversation

Arkalo2
Copy link

@Arkalo2 Arkalo2 commented May 27, 2024

This feature aims to separate the enabling of handlers based on the environment.

Use Case :

You have 3 servers on your project : dev, staging, and prod

  • On your dev machine, you are in the dev environment.
  • On your staging server, you are in the prod environment.
  • On your prod server, you are in the prod environment.

Currently, you can't disable handlers for a specific environment. For an instance, you can't disable logging only in your staging environment.

With the enabled parameter, you are able to disable logging only in the staging environment.

@@ -446,6 +446,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->end()
->end()
->scalarNode('id')->end() // service & rollbar
->scalarNode('enabled')->defaultTrue()->end()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it intended that this is not a booleanNode?

@@ -75,6 +75,9 @@ public function load(array $configs, ContainerBuilder $container)
$handlers = [];

foreach ($config['handlers'] as $name => $handler) {
if(false === $handler['enabled']) {
Copy link
Member

@nicolas-grekas nicolas-grekas Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CS is broken
and if this is a boolean, there's no need for any comparisons:

Suggested change
if(false === $handler['enabled']) {
if (!$handler['enabled']) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants