Skip to content
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

[spiral/debug] Adding Spiral\Debug\Config\DebugConfig #1026

Merged
merged 7 commits into from
Dec 13, 2023

Conversation

msmakouz
Copy link
Member

Q A
Bugfix?
Breaks BC?
New feature? ✔️

The Spiral\Debug\Config\DebugConfig has been added for easy addition of tags and collectors. Tags and collectors can be added using the debug.php configuration file:

use App\StateCollector\AppCollector;
use Spiral\Boot\Environment\AppEnvironment;
use Spiral\Core\Container\Autowire;

return [
    'tags' => [
        'env' => static fn (AppEnvironment $env): string => $env->isProduction() ? 'prod' : 'dev',
        'service' => 'users'
    ],
    'collectors' => [
        AppCollector::class,
        // new AppCollector(),
        // new Autowire(AppCollector::class),
    ]
];

Or via bootloader:

namespace App\Application\Bootloader;

use App\StateCollector\AppCollector;
use Spiral\Boot\Bootloader\Bootloader;
use Spiral\Boot\Environment\AppEnvironment;
use Spiral\Bootloader\DebugBootloader;

final class AppDebugBootloader extends Bootloader
{
    public function init(DebugBootloader $debug): void
    {
        $debug->addStateCollector(AppCollector::class);

        $debug->addTag('env', static fn (AppEnvironment $env): string => $env->isProduction() ? 'prod' : 'dev');
        $debug->addTag('service', 'users');
    }
}

@msmakouz msmakouz added this to the 3.11 milestone Dec 12, 2023
@msmakouz msmakouz self-assigned this Dec 12, 2023
@msmakouz msmakouz changed the title Feature/debug config Adding Spiral\Debug\Config\DebugConfig Dec 12, 2023
Copy link

codecov bot commented Dec 12, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8f8adff) 89.23% compared to head (0688c19) 89.24%.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1026   +/-   ##
=========================================
  Coverage     89.23%   89.24%           
- Complexity     6193     6202    +9     
=========================================
  Files           816      817    +1     
  Lines         17455    17476   +21     
=========================================
+ Hits          15576    15596   +20     
- Misses         1879     1880    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@butschster butschster modified the milestones: 3.11, 3.10 Dec 13, 2023
@butschster butschster merged commit 5c4bacb into master Dec 13, 2023
12 checks passed
@butschster butschster deleted the feature/debug-config branch December 13, 2023 13:03
@butschster butschster changed the title Adding Spiral\Debug\Config\DebugConfig [spiral/debug] Adding Spiral\Debug\Config\DebugConfig Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants