specific log files for commands and jobs
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user