Fixes log levels displaying

main
Yasen Pramatarov 2025-04-27 21:38:24 +03:00
parent d886bcf755
commit fd835dd058
3 changed files with 19 additions and 1 deletions

View File

@ -115,5 +115,8 @@ $username = $userObject->getUserDetails($userId)[0]['username'];
// Get any new feedback messages
include dirname(__FILE__, 4) . '/app/helpers/feedback.php';
// Load plugin helpers
include PLUGIN_LOGS_PATH . 'helpers/logs_view_helper.php';
// Display messages list
include PLUGIN_LOGS_PATH . 'views/logs.php';

View File

@ -0,0 +1,15 @@
<?php
function getLogLevelClass($level) {
switch (strtolower($level)) {
case 'emergency': return 'text-danger fw-bold';
case 'alert': return 'text-danger';
case 'critical': return 'text-warning fw-bold';
case 'error': return 'text-warning';
case 'warning': return 'text-warning';
case 'notice': return 'text-primary';
case 'info': return 'text-info';
case 'debug': return 'text-muted';
default: return 'text-body'; // fallback normal text
}
}

View File

@ -93,7 +93,7 @@
<td style="white-space: nowrap;"><?= $row['userID'] ? '<strong>' . htmlspecialchars($row['username'] . " ({$row['userID']})") . '</strong>' : '<span class="text-muted font-weight-normal small">SYSTEM</span>' ?></td>
<?php } ?>
<td style="white-space: nowrap;"><span class="text-muted"><?= date('d M Y H:i', strtotime($row['time'])) ?></span></td>
<td style="white-space: nowrap;"><?= htmlspecialchars($row['log level']) ?></td>
<td style="white-space: nowrap;"><span class="<?= getLogLevelClass($row['log level']) ?>"><?= htmlspecialchars($row['log level']) ?></span></td>
<td style="width: 100%; word-break: break-word;"><?= htmlspecialchars($row['log message']) ?></td>
</tr>
<?php } ?>