Merge pull request #14146 from annando/loglevels

Improve the log level display
This commit is contained in:
Hypolite Petovan 2024-05-13 14:14:10 -04:00 committed by GitHub
commit 104d355096
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 30 additions and 12 deletions

View file

@ -66,11 +66,14 @@ class Settings extends BaseAdmin
parent::content();
$log_choices = [
LogLevel::ERROR => 'Error',
LogLevel::WARNING => 'Warning',
LogLevel::NOTICE => 'Notice',
LogLevel::INFO => 'Info',
LogLevel::DEBUG => 'Debug',
LogLevel::EMERGENCY => 'Emergency',
LogLevel::ALERT => 'Alert',
LogLevel::CRITICAL => 'Critical',
LogLevel::ERROR => 'Error',
LogLevel::WARNING => 'Warning',
LogLevel::NOTICE => 'Notice',
LogLevel::INFO => 'Info',
LogLevel::DEBUG => 'Debug',
];
if (ini_get('log_errors')) {

View file

@ -47,6 +47,8 @@ class View extends BaseAdmin
$filters_valid_values = [
'level' => [
'',
LogLevel::EMERGENCY,
LogLevel::ALERT,
LogLevel::CRITICAL,
LogLevel::ERROR,
LogLevel::WARNING,
@ -54,7 +56,7 @@ class View extends BaseAdmin
LogLevel::INFO,
LogLevel::DEBUG,
],
'context' => ['', 'index', 'worker'],
'context' => ['', 'index', 'worker', 'daemon'],
];
$filters = [
'level' => $_GET['level'] ?? '',
@ -71,10 +73,10 @@ class View extends BaseAdmin
} else {
try {
$data = DI::parsedLogIterator()
->open($f)
->withLimit(self::LIMIT)
->withFilters($filters)
->withSearch($search);
->open($f)
->withLimit(self::LIMIT)
->withFilters($filters)
->withSearch($search);
} catch (\Exception $e) {
$error = DI::l10n()->t('Couldn\'t open <strong>%1$s</strong> log file.<br/>Check to see if file %1$s is readable.', $f);
}

View file

@ -773,3 +773,13 @@ figure.img-allocated-height img{
color: #731289; /* purple */
font-weight: bold;
}
.loglevel-alert {
color: #ff0000; /* red */
font-weight: bold;
font-style: italic;
}
.loglevel-emergency {
color: #731289; /* purple */
font-weight: bold;
font-style: italic;
}

View file

@ -65,11 +65,14 @@
data-data="{{$row->data}}" data-source="{{$row->source}}">
<td>{{$row->date}}</td>
<td class="
{{if $row->level == "CRITICAL"}}bg-danger
{{if $row->level == "EMERGENCY"}}bg-danger
{{elseif $row->level == "ALERT"}}bg-danger
{{elseif $row->level == "CRITICAL"}}bg-danger
{{elseif $row->level == "ERROR"}}bg-danger
{{elseif $row->level == "WARNING"}}bg-warning
{{elseif $row->level == "NOTICE"}}bg-info
{{elseif $row->level == "DEBUG"}}text-muted
{{elseif $row->level == "INFO"}}bg-info
{{else}}text-muted
{{/if}}
">{{$row->level}}</td>
<td>{{$row->context}}</td>