matrix-gptbot/classes/logging.py
Kumi 1dc0378853
Create a bot class
Make everything compatible with that
2023-04-25 11:25:53 +00:00

10 lines
327 B
Python

import inspect
from datetime import datetime
class Logger:
def log(self, message: str, log_level: str = "info"):
caller = inspect.currentframe().f_back.f_code.co_name
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S:%f")
print(f"[{timestamp}] - {caller} - [{log_level.upper()}] {message}")