Skip to content

Commit 48fbeab

Browse files
committed
Add log for interactive term
1 parent eb0a36e commit 48fbeab

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/StaticPHP/Util/InteractiveTerm.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public static function notice(string $message, bool $indent = false): void
2323
logger()->notice(strip_ansi_colors($message));
2424
} else {
2525
$output->writeln(($no_ansi ? 'strip_ansi_colors' : 'strval')(ConsoleColor::cyan(($indent ? ' ' : '') . '') . $message));
26+
logger()->debug(strip_ansi_colors($message));
2627
}
2728
}
2829

@@ -34,15 +35,22 @@ public static function success(string $message, bool $indent = false): void
3435
logger()->info(strip_ansi_colors($message));
3536
} else {
3637
$output->writeln(($no_ansi ? 'strip_ansi_colors' : 'strval')(ConsoleColor::green(($indent ? ' ' : '') . '') . $message));
38+
logger()->debug(strip_ansi_colors($message));
3739
}
3840
}
3941

40-
public static function plain(string $message): void
42+
public static function plain(string $message, string $level = 'info'): void
4143
{
4244
$no_ansi = ApplicationContext::get(InputInterface::class)?->getOption('no-ansi') ?? false;
4345
$output = ApplicationContext::get(OutputInterface::class) ?? new ConsoleOutput();
4446
if ($output->isVerbose()) {
45-
logger()->info(strip_ansi_colors($message));
47+
match ($level) {
48+
'debug' => logger()->debug(strip_ansi_colors($message)),
49+
'notice' => logger()->notice(strip_ansi_colors($message)),
50+
'warning' => logger()->warning(strip_ansi_colors($message)),
51+
'error' => logger()->error(strip_ansi_colors($message)),
52+
default => logger()->info(strip_ansi_colors($message)),
53+
};
4654
} else {
4755
$output->writeln(($no_ansi ? 'strip_ansi_colors' : 'strval')($message));
4856
}
@@ -66,6 +74,7 @@ public static function error(string $message, bool $indent = true): void
6674
logger()->error(strip_ansi_colors($message));
6775
} else {
6876
$output->writeln(($no_ansi ? 'strip_ansi_colors' : 'strval')(ConsoleColor::red(($indent ? ' ' : '') . '' . $message)));
77+
logger()->debug(strip_ansi_colors($message));
6978
}
7079
}
7180

@@ -78,6 +87,7 @@ public static function setMessage(string $message): void
7887
{
7988
$no_ansi = ApplicationContext::get(InputInterface::class)?->getOption('no-ansi') ?? false;
8089
self::$indicator?->setMessage(($no_ansi ? 'strip_ansi_colors' : 'strval')($message));
90+
logger()->debug(strip_ansi_colors($message));
8191
}
8292

8393
public static function finish(string $message, bool $status = true): void
@@ -117,6 +127,7 @@ public static function indicateProgress(string $message): void
117127
self::$indicator->advance();
118128
return;
119129
}
130+
logger()->debug(strip_ansi_colors($message));
120131
// if no ansi, use a dot instead of spinner
121132
if ($no_ansi) {
122133
self::$indicator = new ProgressIndicator(ApplicationContext::get(OutputInterface::class), 'verbose', 100, ['', '']);

0 commit comments

Comments
 (0)