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
+6 -2
View File
@@ -7,6 +7,7 @@ use App\Models\JobSource;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
#[Signature('jobs:fetch {source?} {--limit=50} {--sync}')]
#[Description('Fetch jobs from API sources and queue them for processing')]
@@ -24,25 +25,28 @@ class FetchJobs extends Command
$limit = (int) $this->option('limit');
$sync = $this->option('sync');
$log = Log::channel('jobs_fetch');
$log->info('Starting job fetch command', ['source' => $sourceName, 'limit' => $limit, 'sync' => $sync]);
$this->info('Starting job fetch process...');
$this->newLine();
try {
if ($sourceName) {
// Fetch from specific source
$this->fetchFromSource($sourceName, $limit, $sync);
} else {
// Fetch from all active sources
$this->fetchFromAllSources($limit, $sync);
}
$this->newLine();
$this->info('Job fetch process completed!');
$log->info('Job fetch command completed');
return self::SUCCESS;
} catch (\Exception $e) {
$this->error("Failed to fetch jobs: {$e->getMessage()}");
$log->error('Job fetch command failed', ['error' => $e->getMessage()]);
return self::FAILURE;
}
}