contentmonster/classes/logger.py

21 lines
604 B
Python
Raw Normal View History

import logging
2021-11-30 16:33:47 +00:00
import threading
from datetime import datetime
class Logger:
2021-11-30 16:33:47 +00:00
@staticmethod
def _format(message: str, severity: str) -> str:
thread = threading.current_thread().name
datestr = str(datetime.now())
return f"{datestr} - {thread} - {severity} - {message}"
def debug(self, message: str) -> None:
print(self.__class__()._format(message, "DEBUG"))
2021-11-30 16:33:47 +00:00
def info(self, message: str) -> None:
2021-11-30 16:52:40 +00:00
print(self.__class__()._format(message, "INFO"))
def error(self, message: str) -> None:
print(self.__class__()._format(message, "ERROR"))