#feature: update log format
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Console\Commands;
|
||||
|
||||
use App\Services\JenkinsMonitorService;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class JenkinsMonitorCommand extends Command
|
||||
{
|
||||
@@ -13,29 +14,29 @@ class JenkinsMonitorCommand extends Command
|
||||
|
||||
public function handle(JenkinsMonitorService $service): void
|
||||
{
|
||||
$this->info('开始检查 Jenkins 构建...');
|
||||
Log::info('开始检查 Jenkins 构建...');
|
||||
|
||||
$results = $service->checkAllProjects();
|
||||
|
||||
if (isset($results['skipped'])) {
|
||||
$this->warn('跳过检查: ' . ($results['reason'] ?? 'unknown'));
|
||||
Log::warning('跳过检查: ' . ($results['reason'] ?? 'unknown'));
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($results as $slug => $result) {
|
||||
if (isset($result['skipped'])) {
|
||||
$this->line(sprintf('[%s] 跳过: %s', $slug, $result['reason'] ?? 'unknown'));
|
||||
Log::info(sprintf('[%s] 跳过: %s', $slug, $result['reason'] ?? 'unknown'));
|
||||
continue;
|
||||
}
|
||||
|
||||
$newBuilds = $result['new_builds'] ?? [];
|
||||
if (empty($newBuilds)) {
|
||||
$this->line(sprintf('[%s] 无新构建', $slug));
|
||||
Log::info(sprintf('[%s] 无新构建', $slug));
|
||||
} else {
|
||||
$this->info(sprintf('[%s] 发现 %d 个新构建: #%s', $slug, count($newBuilds), implode(', #', $newBuilds)));
|
||||
Log::info(sprintf('[%s] 发现 %d 个新构建: #%s', $slug, count($newBuilds), implode(', #', $newBuilds)));
|
||||
}
|
||||
}
|
||||
|
||||
$this->info('检查完成');
|
||||
Log::info('检查完成');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user