errors: use color wrapper
This allows the program to work without termcolor installed
This commit is contained in:
parent
df65952cfc
commit
4d13cdfb46
1 changed files with 3 additions and 5 deletions
|
|
@ -5,16 +5,14 @@ import inspect
|
||||||
import sys
|
import sys
|
||||||
from typing import TextIO
|
from typing import TextIO
|
||||||
|
|
||||||
from termcolor import termcolor
|
from . import source, lexer, color
|
||||||
|
|
||||||
from . import source, lexer
|
|
||||||
from .logger import rootLogger, LogLevel
|
from .logger import rootLogger, LogLevel
|
||||||
from .source import TextIOWithMemory
|
from .source import TextIOWithMemory
|
||||||
|
|
||||||
|
|
||||||
class LevelType:
|
class LevelType:
|
||||||
|
|
||||||
def __init__(self, name: str, color: termcolor.Color = None):
|
def __init__(self, name: str, color: color.Color = None):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
:param name:
|
:param name:
|
||||||
|
|
@ -27,7 +25,7 @@ class LevelType:
|
||||||
return self.show_with_suffix()
|
return self.show_with_suffix()
|
||||||
|
|
||||||
def show_with_suffix(self, suffix=":") -> str:
|
def show_with_suffix(self, suffix=":") -> str:
|
||||||
return termcolor.colored(f"{self.name}{suffix}", color=self.color, attrs=["bold"])
|
return color.colored(f"{self.name}{suffix}", color=self.color, attrs=["bold"])
|
||||||
|
|
||||||
|
|
||||||
class Levels(enum.Enum):
|
class Levels(enum.Enum):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue