24 lines
806 B
Python
24 lines
806 B
Python
from . 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.Utils.bold)),
|
|
'ERROR': Level('ERROR', 3, _color=console.FG.red),
|
|
'WARNING': Level('WARNING', 2, _color=(console.FG.yellow + console.Utils.bold + console.Utils.underline)),
|
|
'INFO': Level('INFO', 1, _color=console.FG.blue),
|
|
'DEBUG': Level('DEBUG', 0, _color=console.FG.green)
|
|
}
|