Skip to content

Commit

Permalink
change how recorders are declared
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesbilbo committed Oct 24, 2022
1 parent db35770 commit 998a6fa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 27 deletions.
28 changes: 18 additions & 10 deletions config/ignition.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
use Spatie\Ignition\Solutions\SolutionProviders\BadMethodCallSolutionProvider;
use Spatie\Ignition\Solutions\SolutionProviders\MergeConflictSolutionProvider;
use Spatie\Ignition\Solutions\SolutionProviders\UndefinedPropertySolutionProvider;
use Spatie\LaravelIgnition\Recorders\DumpRecorder\DumpRecorder;
use Spatie\LaravelIgnition\Recorders\JobRecorder\JobRecorder;
use Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder;
use Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\DefaultDbNameSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\GenericLaravelExceptionSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\IncorrectValetDbCredentialsSolutionProvider;
Expand Down Expand Up @@ -211,16 +215,20 @@

'settings_file_path' => '',

'should_record' => env(
'IGNITION_RECORD',
env('APP_DEBUG', true) && env('APP_ENV', 'local') != 'production'
),

/*
|--------------------------------------------------------------------------
| Recorders
|--------------------------------------------------------------------------
|
| Ignition registers a couple of recorders when it is enabled. Below you may
| specify a recorders will be used to record specific events.
|
*/

'recorders' => [
'jobs' => env('IGNITION_RECORD_JOBS', true),
'dumps' => env('IGNITION_RECORD_DUMPS', true),
'logs' => env('IGNITION_RECORD_LOGS', true),
'queries' => env('IGNITION_RECORD_QUERIES', true)
DumpRecorder::class,
JobRecorder::class,
LogRecorder::class,
QueryRecorder::class
]

];
19 changes: 2 additions & 17 deletions src/IgnitionServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,23 +244,8 @@ protected function registerLogHandler(): void

protected function startRecorders(): void
{
if ($this->app->config['ignition.should_record']) {

if ($this->app->config['ignition.recorders.dumps']) {
$this->app->make(DumpRecorder::class)->start();
}

if ($this->app->config['ignition.recorders.logs']) {
$this->app->make(LogRecorder::class)->start();
}

if ($this->app->config['ignition.recorders.queries']) {
$this->app->make(QueryRecorder::class)->start();
}

if ($this->app->config['ignition.recorders.jobs']) {
$this->app->make(JobRecorder::class)->start();
}
foreach ($this->app->config['ignition.recorders'] as $recorder) {
$this->app->make($recorder)->start();
}
}

Expand Down

0 comments on commit 998a6fa

Please sign in to comment.