private function compareLevel(string $a, string $b): int {
        $i = array_search($a, static::$levels);
        if ($i === false) {
            throw new InvalidArgumentException("Log level is invalid: $a", 500);
        }

        return $i <=> array_search($b, static::$levels);
    }