specific log files for commands and jobs

This commit is contained in:
Doar Mihai
2026-05-02 01:40:46 +03:00
parent 792a598eda
commit 462eb2fc61
10 changed files with 138 additions and 31 deletions
@@ -7,6 +7,7 @@ use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
#[Signature('jobs:summary {--batch=50}')]
#[Description('Command description')]
@@ -18,12 +19,24 @@ class GenerateJobSummaryCommand extends Command
public function handle()
{
$batchSize = (int) $this->option('batch');
$log = Log::channel('jobs_summary');
$log->info('Starting summary generation', ['batch_size' => $batchSize]);
$jobs = $this->getJobs($batchSize);
$processed = 0;
$failed = 0;
foreach ($jobs as $job) {
$this->processJob($job);
try {
$this->processJob($job);
$processed++;
} catch (\Exception $e) {
$failed++;
$log->error("Failed to generate summary for job #{$job->id}", ['error' => $e->getMessage()]);
}
}
$log->info('Summary generation complete', ['processed' => $processed, 'failed' => $failed]);
}
private function getJobs(int $batchSize)