Improve the log level display

This commit is contained in:
Michael 2024-05-11 19:56:28 +00:00
parent 9ae4a17977
commit 82327b0b06
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);
}