moodle-export-worker/logger.py

19 lines
612 B
Python
Raw Normal View History

2022-01-13 07:08:54 +00:00
from datetime import datetime
class Logger:
@staticmethod
def _format(message: str, severity: str) -> str:
datestr = str(datetime.now())
return f"{datestr} - {severity} - {message}"
def debug(self, message: str) -> None:
print(self.__class__()._format(message, "DEBUG"))
def info(self, message: str) -> None:
print(self.__class__()._format(message, "INFO"))
def error(self, message: str) -> None:
print(self.__class__()._format(message, "ERROR"))
def fatal(self, message: str) -> None:
print(self.__class__()._format(message, "FATAL"))