specific log files for commands and jobs
This commit is contained in:
@@ -7,6 +7,7 @@ use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
#[Signature('jobs:deduplicate {--dry-run}')]
|
||||
#[Description('Find and remove duplicate job listings based on fingerprint')]
|
||||
@@ -21,6 +22,8 @@ class DeduplicateJobs extends Command
|
||||
public function handle(): int
|
||||
{
|
||||
$dryRun = $this->option('dry-run');
|
||||
$log = Log::channel('jobs_deduplicate');
|
||||
$log->info('Starting deduplication', ['dry_run' => $dryRun]);
|
||||
|
||||
$this->info('Searching for duplicate job listings...');
|
||||
$this->newLine();
|
||||
@@ -30,6 +33,7 @@ class DeduplicateJobs extends Command
|
||||
|
||||
if ($duplicates->isEmpty()) {
|
||||
$this->info('No duplicates found!');
|
||||
$log->info('No duplicates found');
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
@@ -67,10 +71,13 @@ class DeduplicateJobs extends Command
|
||||
}
|
||||
|
||||
if ($dryRun) {
|
||||
$this->info("Dry run completed. Would remove {$this->countDuplicatesToRemove($duplicates)} duplicate jobs.");
|
||||
$wouldRemove = $this->countDuplicatesToRemove($duplicates);
|
||||
$this->info("Dry run completed. Would remove {$wouldRemove} duplicate jobs.");
|
||||
$this->line('Run without --dry-run to actually remove them.');
|
||||
$log->info('Dry run complete', ['would_remove' => $wouldRemove]);
|
||||
} else {
|
||||
$this->info("Removed {$removedCount} duplicate jobs.");
|
||||
$log->info('Deduplication complete', ['removed' => $removedCount]);
|
||||
}
|
||||
|
||||
return self::SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user