printing max rpm message in different color

This commit is contained in:
João Moura
2024-09-18 04:35:18 -03:00
parent 5a3b888f43
commit 5e8322b272
2 changed files with 7 additions and 2 deletions

View File

@@ -9,9 +9,9 @@ class Logger(BaseModel):
verbose: bool = Field(default=False)
_printer: Printer = PrivateAttr(default_factory=Printer)
def log(self, level, message, color="bold_green"):
def log(self, level, message, color="bold_yellow"):
if self.verbose:
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
self._printer.print(
f"[{timestamp}][{level.upper()}]: {message}", color=color
f"\n[{timestamp}][{level.upper()}]: {message}", color=color
)

View File

@@ -15,6 +15,8 @@ class Printer:
self._print_bold_blue(content)
elif color == "yellow":
self._print_yellow(content)
elif color == "bold_yellow":
self._print_bold_yellow(content)
else:
print(content)
@@ -35,3 +37,6 @@ class Printer:
def _print_yellow(self, content):
print("\033[93m {}\033[00m".format(content))
def _print_bold_yellow(self, content):
print("\033[1m\033[93m {}\033[00m".format(content))