From aad260c31eaf1261f8785b2b982b7d8809b31136 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 9 Jul 2024 00:44:03 +0800 Subject: [PATCH] Adjust shell debug log --- src/SPC/util/UnixShell.php | 5 ++++- src/globals/functions.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/SPC/util/UnixShell.php b/src/SPC/util/UnixShell.php index 1556336d..16ae3f8c 100644 --- a/src/SPC/util/UnixShell.php +++ b/src/SPC/util/UnixShell.php @@ -41,6 +41,7 @@ class UnixShell { /* @phpstan-ignore-next-line */ logger()->info(ConsoleColor::yellow('[EXEC] ') . ConsoleColor::green($cmd)); + logger()->debug('Executed at: ' . debug_backtrace()[0]['file'] . ':' . debug_backtrace()[0]['line']); if ($this->cd !== null) { $cmd = 'cd ' . escapeshellarg($this->cd) . ' && ' . $cmd; } @@ -57,8 +58,10 @@ class UnixShell /* @phpstan-ignore-next-line */ logger()->info(ConsoleColor::blue('[EXEC] ') . ConsoleColor::green($cmd)); } else { - logger()->debug('Running command with result: ' . $cmd); + /* @phpstan-ignore-next-line */ + logger()->debug(ConsoleColor::blue('[EXEC] ') . ConsoleColor::gray($cmd)); } + logger()->debug('Executed at: ' . debug_backtrace()[0]['file'] . ':' . debug_backtrace()[0]['line']); exec($cmd, $out, $code); return [$code, $out]; } diff --git a/src/globals/functions.php b/src/globals/functions.php index e61a8d6e..2a9de625 100644 --- a/src/globals/functions.php +++ b/src/globals/functions.php @@ -140,7 +140,7 @@ function f_passthru(string $cmd): ?bool if ($danger) { logger()->notice('Running dangerous command: ' . $cmd); } else { - logger()->debug('Running command with direct output: ' . $cmd); + logger()->debug('[PASSTHRU] ' . $cmd); } $ret = passthru($cmd, $code); if ($code !== 0) {