Module pyboiler.internal.log.level

Wrap python.logging levels

Classes

class Level (*args, **kwds)

Enum for getting logging levels

Expand source code
@unique
class Level(Enum):
    """Enum for getting logging levels"""

    ALL = 100
    ERROR = 50
    WARN = 40
    INFO = 30
    DEBUG = 20
    TRACE = 10
    NOTSET = 0

    def __lt__(self, other):
        return self.value < other.value

    def __le__(self, other):
        return self.value <= other.value

    def __gt__(self, other):
        return self.value > other.value

    def __ge__(self, other):
        return self.value >= other.value

    @staticmethod
    def get(key):
        if isinstance(key, Level):
            return key
        if isinstance(key, str):
            return Level[key.upper()]
        return Level.NOTSET

    @staticmethod
    def s():
        return list(Level)

Ancestors

  • enum.Enum

Class variables

var ALL
var DEBUG
var ERROR
var INFO
var NOTSET
var TRACE
var WARN

Static methods

def get(key)
def s()
class LevelColors (*args, **kwds)

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

Color.RED

  • value lookup:

Color(1)

  • name lookup:

Color['RED']

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

Expand source code
class LevelColors(Enum):
    ALL = ""
    ERROR = f"{c_conf.TAG_START}fRED{c_conf.TAG_END}"
    WARN = f"{c_conf.TAG_START}fMAGENTA{c_conf.TAG_END}"
    INFO = f"{c_conf.TAG_START}fWHITE{c_conf.TAG_END}"
    DEBUG = f"{c_conf.TAG_START}fLIGHT_WHITE{c_conf.TAG_END}"
    TRACE = f"{c_conf.TAG_START}fLIGHT_BLUE{c_conf.TAG_END}"
    NOTSET = ""

Ancestors

  • enum.Enum

Class variables

var ALL
var DEBUG
var ERROR
var INFO
var NOTSET
var TRACE
var WARN