-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathutils.py
40 lines (28 loc) · 1.09 KB
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import sys
from datetime import datetime
from rich.console import Console
class Logger:
def __init__(self):
self.__console = Console()
def info(self, log, exit=0):
now = datetime.now()
now = now.strftime("%H:%M:%S")
log = f"[bold green][{now}][/] [bold yellow][MKVTagger][/] [deep_sky_blue1]INFO:[/] [bold bright_white]{log}[/]"
self.__console.print(log)
if exit == 1:
sys.exit()
def error(self, log, exit=0):
now = datetime.now()
now = now.strftime("%H:%M:%S")
log = f"[bold green][{now}][/] [bold yellow][MKVTagger][/] [bold red]ERROR:[/] [bold bright_white]{log}[/]"
self.__console.print(log)
if exit == 1:
sys.exit()
def warning(self, log, exit=0):
now = datetime.now()
now = now.strftime("%H:%M:%S")
log = f"[bold green][{now}][/] [bold yellow][MKVTagger][/] [bold red]WARNING:[/] [bold bright_white]{log}[/]"
self.__console.print(log)
if exit == 1:
sys.exit()
logger = Logger()