Add LoggingManager

This commit is contained in:
Matthew Stratford 2020-10-30 22:00:30 +00:00
parent 92d48993e7
commit 808bef5f5d
No known key found for this signature in database
GPG key ID: 5F50E4308A3416E8
2 changed files with 25 additions and 0 deletions

0
helpers/__init__.py Normal file
View file

View file

@ -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