@staticmethod
def level_matches(level, consumer_level):
    """
        >>> l = Logger([])
        >>> l.level_matches(3, 4)
        False
        >>> l.level_matches(3, 2)
        True
        >>> l.level_matches(slice(None, 3), 3)
        False
        >>> l.level_matches(slice(None, 3), 2)
        True
        >>> l.level_matches(slice(1, 3), 1)
        True
        >>> l.level_matches(slice(2, 3), 1)
        False
        """
    if isinstance(level, slice):
        start, stop = level.start, level.stop
        if start is not None and start > consumer_level:
            return False
        if stop is not None and stop <= consumer_level:
            return False
        return True
    else:
        return level >= consumer_level
