18 lines
467 B
Python
18 lines
467 B
Python
from .config import config
|
|
from datetime import datetime
|
|
|
|
class LogLevel:
|
|
INFO = '[INFO]'
|
|
WARN = '[WARNING]'
|
|
ERROR = '[ERROR]'
|
|
|
|
def log_message(level: LogLevel, message: str) -> None:
|
|
log = f'{level} - {datetime.now().strftime("%Y-%m-%d %H:%M:%S")} - {message}\n'
|
|
|
|
if config['ttf_print_logs']:
|
|
print(log, end='')
|
|
|
|
if config['ttf_write_logs']:
|
|
with open(config['ttf_log_file'], 'a') as log_file:
|
|
log_file.write(log)
|