This repository has been archived on 2023-04-13. You can view files and clone it, but cannot push or open issues or pull requests.
pylogger/src/lib/LogLevels.py

24 lines
766 B
Python

from lib import console
class Level:
def __init__(self, name: str, weight: int, short_name: str or None = None, _color: str = console.fg.white):
"""
Create a logging level.
"""
self.name = name
self.weight = weight
self.color = _color
if short_name is None:
self.short = name.upper()[:1]
else:
self.short = short_name.upper()
basic_levels = {
'FATAL': Level('FATAL', 10, _color=(console.fg.red + console.util.bold)),
'ERROR': Level('ERROR', 3, _color=console.fg.red),
'WARNING': Level('WARNING', 2, _color=console.fg.yellow),
'INFO': Level('INFO', 1, _color=console.fg.blue),
'DEBUG': Level('DEBUG', 0, _color=console.fg.green)
}