Log: when PHP cli-server is running, log on console

This commit is contained in:
Benjamin Renard 2023-03-01 11:55:46 +01:00
parent b679783fb8
commit 21b425e32b
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -198,10 +198,10 @@ class Log {
$msg[] = $message;
$msg = implode(' - ', $msg)."\n";
}
if (self :: $file_fd)
if (!self :: $file_fd || php_sapi_name() == 'cli-server')
error_log(rtrim($msg, "\n"));
else
fwrite(self :: $file_fd, $msg);
elseif (self :: $error_log_fallback)
error_log($msg);
if ($level == 'FATAL')
if (!is_null(self :: $fatal_error_handler))