. */ namespace App\Services\LogSystem; use App\Entity\LogSystem\AbstractLogEntry; use Psr\Log\LogLevel; class LogLevelHelper { /** * Returns the FontAwesome icon class for the given log level. * This returns just the specific icon class (so 'fa-info' for example). * @param string $logLevel The string representation of the log level (one of the LogLevel::* constants) */ public function logLevelToIconClass(string $logLevel): string { return match ($logLevel) { LogLevel::DEBUG => 'fa-bug', LogLevel::INFO => 'fa-info', LogLevel::NOTICE => 'fa-flag', LogLevel::WARNING => 'fa-exclamation-circle', LogLevel::ERROR => 'fa-exclamation-triangle', LogLevel::CRITICAL => 'fa-bolt', LogLevel::ALERT => 'fa-radiation', LogLevel::EMERGENCY => 'fa-skull-crossbones', default => 'fa-question-circle', }; } /** * Returns the Bootstrap table color class for the given log level. * @param string $logLevel The string representation of the log level (one of the LogLevel::* constants) * @return string The table color class (one of the 'table-*' classes) */ public function logLevelToTableColorClass(string $logLevel): string { return match ($logLevel) { LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR => 'table-danger', LogLevel::WARNING => 'table-warning', LogLevel::NOTICE => 'table-info', default => '', }; } }