diff --git a/helpers/__init__.py b/helpers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/helpers/logging_manager.py b/helpers/logging_manager.py new file mode 100644 index 0000000..b3c60e6 --- /dev/null +++ b/helpers/logging_manager.py @@ -0,0 +1,25 @@ +import logging +from helpers.os_environment import resolve_external_file_path + + +class LoggingManager(): + + logger = None + + def __init__(self, name): + self.logger = logging.getLogger(name) + + logging.basicConfig( + filename=resolve_external_file_path("/logs/" + name + ".txt"), + format='%(asctime)s | %(levelname)s | %(message)s', + level=logging.INFO, + filemode='a' + ) + self.logger.info("Logger Started.") + + def __del__(self): + logging.shutdown() + + @property + def log(self): + return self.logger