diff --git a/src/Log/Level.php b/src/Log/Level.php index 0dda093..d3f6944 100644 --- a/src/Log/Level.php +++ b/src/Log/Level.php @@ -63,4 +63,15 @@ public function jsonSerialize(): int { return $this->value; } + + /** + * @inheritDoc + */ + public function isError(): bool + { + return $this === Level::EMERGENCY + || $this === Level::ALERT + || $this === Level::CRITICAL + || $this === Level::ERROR; + } } diff --git a/src/Log/LevelInterface.php b/src/Log/LevelInterface.php index 8df993b..99bd14c 100644 --- a/src/Log/LevelInterface.php +++ b/src/Log/LevelInterface.php @@ -21,4 +21,11 @@ public function asString(): string; * @return int */ public function asInt(): int; -} \ No newline at end of file + + /** + * Returns true if the log level should be considered an error level. + * + * @return bool + */ + public function isError(): bool; +}