Add a noset level and add uppercase support to fromName()
Noset is for unset status, which is different from unknown. Also allow upper case so we can use "OK" and "ERROR" in addition to "ok" and "error".
This commit is contained in:
@@ -13,6 +13,7 @@ namespace CoreLibs\Logging\Logger;
|
||||
|
||||
enum MessageLevel: int
|
||||
{
|
||||
case noset = 0;
|
||||
case ok = 100;
|
||||
case success = 150; // special for file uploads
|
||||
case info = 200;
|
||||
@@ -30,14 +31,14 @@ enum MessageLevel: int
|
||||
public static function fromName(string $name): self
|
||||
{
|
||||
return match (strtolower($name)) {
|
||||
'ok' => self::ok,
|
||||
'success' => self::success,
|
||||
'info' => self::info,
|
||||
'notice' => self::notice,
|
||||
'warn', 'warning' => self::warn,
|
||||
'error' => self::error,
|
||||
'abort' => self::abort,
|
||||
'crash' => self::crash,
|
||||
'ok', 'OK' => self::ok,
|
||||
'success', 'SUCCESS' => self::success,
|
||||
'info', 'INFO' => self::info,
|
||||
'notice', 'NOTICE' => self::notice,
|
||||
'warn', 'warning', 'WARN', 'WARNING' => self::warn,
|
||||
'error', 'ERROR' => self::error,
|
||||
'abort', 'ABORT' => self::abort,
|
||||
'crash', 'CRASH' => self::crash,
|
||||
default => self::unknown,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user