#feature: update log format

This commit is contained in:
2026-01-19 14:21:15 +08:00
parent da3b05b7c0
commit 0646c8612b
7 changed files with 49 additions and 76 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Console\Commands;
use App\Services\GitMonitorService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
class GitMonitorCheckCommand extends Command
{
@@ -24,11 +25,11 @@ class GitMonitorCheckCommand extends Command
foreach ($results as $repo => $result) {
if (isset($result['error'])) {
$this->error(sprintf('[%s] %s', $repo, $result['error']));
Log::error(sprintf('[%s] %s', $repo, $result['error']));
continue;
}
$this->line(sprintf(
Log::info(sprintf(
'[%s] 分支 %s 已对齐 %s扫描 %d 个提交。',
$repo,
$result['branch'],
@@ -37,9 +38,9 @@ class GitMonitorCheckCommand extends Command
));
if (!empty($result['issues']['develop_merges'])) {
$this->warn(sprintf(' - 检测到 %d 个 develop merge:', count($result['issues']['develop_merges'])));
Log::warning(sprintf(' - 检测到 %d 个 develop merge:', count($result['issues']['develop_merges'])));
foreach ($result['issues']['develop_merges'] as $commit) {
$this->warn(sprintf(
Log::warning(sprintf(
' • %s %s (%s)',
substr($commit['hash'], 0, 8),
$commit['subject'],
@@ -49,9 +50,9 @@ class GitMonitorCheckCommand extends Command
}
if (!empty($result['issues']['missing_functions'])) {
$this->warn(sprintf(' - 检测到 %d 个疑似缺失函数的提交:', count($result['issues']['missing_functions'])));
Log::warning(sprintf(' - 检测到 %d 个疑似缺失函数的提交:', count($result['issues']['missing_functions'])));
foreach ($result['issues']['missing_functions'] as $issue) {
$this->warn(sprintf(
Log::warning(sprintf(
' • %s %s (%s)',
substr($issue['commit']['hash'], 0, 8),
$issue['commit']['subject'],
@@ -59,7 +60,7 @@ class GitMonitorCheckCommand extends Command
));
foreach ($issue['details'] as $detail) {
$functions = implode(', ', array_slice($detail['functions'], 0, 5));
$this->warn(sprintf(' %s => %s', $detail['file'], $functions));
Log::warning(sprintf(' %s => %s', $detail['file'], $functions));
}
}
}