Log-Viewer aktualisiert

This commit is contained in:
blaerf 2025-12-17 15:39:27 +01:00
parent 9f0e534e20
commit 2536d66c3e
2 changed files with 17 additions and 1 deletions

View File

@ -308,6 +308,20 @@ class LogViewerService
$message = $rest;
}
if ($level === null) {
$upper = strtoupper($raw);
if (str_starts_with($upper, 'PHP WARNING') || str_starts_with($upper, 'WARNING')) {
$level = 'WARNING';
} elseif (str_starts_with($upper, 'PHP NOTICE') || str_starts_with($upper, 'NOTICE')) {
$level = 'INFO';
} elseif (str_starts_with($upper, 'PHP FATAL') || str_contains($upper, 'FATAL ERROR') || str_starts_with($upper, 'UNCAUGHT')) {
$level = 'ERROR';
} else {
$level = 'UNKNOWN';
}
}
return [
'ts' => $ts,
'level' => $level,

View File

@ -144,7 +144,9 @@ declare(strict_types=1);
<td><?php echo htmlspecialchars((string)($e['message'] ?? ''), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); ?></td>
<td>
<?php if ($ctxPretty !== '') : ?>
<pre class="mb-0" style="white-space: pre-wrap;"><?php echo htmlspecialchars($ctxPretty, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); ?></pre>
<pre class="mb-0 text-white bg-dark p-2 rounded" style="white-space: pre-wrap;">
<?php echo htmlspecialchars($ctxPretty, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); ?>
</pre>
<?php else : ?>
<span class="text-gray-600">-</span>
<?php endif; ?>