2021-11-26 10:23:39 +00:00
|
|
|
import logging
|
2021-11-30 16:33:47 +00:00
|
|
|
import threading
|
|
|
|
|
|
|
|
from datetime import datetime
|
2021-11-26 10:23:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
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-26 10:23:39 +00:00
|
|
|
|
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"))
|