specific log files for commands and jobs
This commit is contained in:
@@ -31,7 +31,10 @@ class CurateJobs extends Command
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$log = Log::channel('jobs_curate');
|
||||
|
||||
$this->info('Starting job curation...');
|
||||
$log->info('Starting job curation batch', ['batch_size' => $batchSize]);
|
||||
$this->newLine();
|
||||
|
||||
// Fetch uncurated jobs
|
||||
@@ -72,11 +75,14 @@ class CurateJobs extends Command
|
||||
'stream' => false,
|
||||
'prompt' => $body,
|
||||
]);
|
||||
|
||||
var_dump($response->json());
|
||||
|
||||
if ($response->successful()) {
|
||||
|
||||
$responseArray = $response->json();
|
||||
$responseTagsJson = $responseArray['response'];
|
||||
Log::info("Curated job id: {$responseArray['job_id']} Result: {$responseTagsJson}");
|
||||
$log->info("Curated job id: {$job->id} Result: {$responseTagsJson}");
|
||||
$tags = json_decode($responseTagsJson, true);
|
||||
|
||||
if (empty($tags) || $tags === null) {
|
||||
@@ -111,11 +117,11 @@ class CurateJobs extends Command
|
||||
}
|
||||
} else {
|
||||
$failedCount++;
|
||||
Log::warning("Failed to curate job #{$job->id}: API returned {$response->status()}");
|
||||
$log->warning("Failed to curate job #{$job->id}: API returned {$response->status()} -> {$response->body()}");
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$failedCount++;
|
||||
Log::error("Error curating job #{$job->id}: {$e->getMessage()}");
|
||||
$log->error("Error curating job #{$job->id}: {$e->getMessage()}");
|
||||
}
|
||||
|
||||
$progressBar->advance();
|
||||
@@ -125,6 +131,7 @@ class CurateJobs extends Command
|
||||
$this->newLine(2);
|
||||
|
||||
$this->info("Successfully curated {$curatedCount} jobs.");
|
||||
$log->info("Curation complete", ['curated' => $curatedCount, 'failed' => $failedCount]);
|
||||
|
||||
if ($failedCount > 0) {
|
||||
$this->warn("Failed to curate {$failedCount} jobs. Check logs for details.");
|
||||
|
||||
Reference in New Issue
Block a user