Log-Viewer aktualisiert

This commit is contained in:
blaerf 2025-12-17 15:50:05 +01:00
parent 2536d66c3e
commit 52223ba1e8
2 changed files with 10 additions and 4 deletions

View File

@ -142,7 +142,13 @@ class LogViewerService
$haystack = $parsed['raw'] . ' ' . $parsed['message']; $haystack = $parsed['raw'] . ' ' . $parsed['message'];
if (is_array($parsed['context'])) { if (is_array($parsed['context'])) {
$haystack .= ' ' . (string)json_encode($parsed['context'], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); $json = json_encode(
$parsed['context'],
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR
);
if ($json !== false) {
$haystack .= ' ' . $json;
}
} }
if (mb_stripos($haystack, $search) === false) { if (mb_stripos($haystack, $search) === false) {
@ -282,7 +288,7 @@ class LogViewerService
$context = null; $context = null;
// Basis: [timestamp] LEVEL ... // Basis: [timestamp] LEVEL ...
if (preg_match('/^\[(?<ts>[0-9\-:\s]{19})\]\s+(?<lvl>[A-Z]+)\s+(?<rest>.*)$/', $line, $m) === 1) { if (preg_match('/^\[(?<ts>[0-9\-:\s]{19})]\s+(?<lvl>[A-Za-z]+)\s+(?<rest>.*)$/', $line, $m) === 1) {
$ts = (string)$m['ts']; $ts = (string)$m['ts'];
$level = (string)$m['lvl']; $level = (string)$m['lvl'];
$rest = (string)$m['rest']; $rest = (string)$m['rest'];

View File

@ -109,7 +109,7 @@ declare(strict_types=1);
<div class="text-gray-600">Keine Einträge gefunden.</div> <div class="text-gray-600">Keine Einträge gefunden.</div>
<?php else : ?> <?php else : ?>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-bordered table-sm" width="100%" cellspacing="0"> <table class="table table-bordered table-sm">
<thead> <thead>
<tr> <tr>
<th style="width: 170px;">Zeit</th> <th style="width: 170px;">Zeit</th>
@ -144,7 +144,7 @@ declare(strict_types=1);
<td><?php echo htmlspecialchars((string)($e['message'] ?? ''), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); ?></td> <td><?php echo htmlspecialchars((string)($e['message'] ?? ''), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); ?></td>
<td> <td>
<?php if ($ctxPretty !== '') : ?> <?php if ($ctxPretty !== '') : ?>
<pre class="mb-0 text-white bg-dark p-2 rounded" style="white-space: pre-wrap;"> <pre class="mb-0 text-white" style="white-space: pre-wrap;">
<?php echo htmlspecialchars($ctxPretty, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); ?> <?php echo htmlspecialchars($ctxPretty, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); ?>
</pre> </pre>
<?php else : ?> <?php else : ?>