Add LoggingManager
This commit is contained in:
parent
92d48993e7
commit
808bef5f5d
2 changed files with 25 additions and 0 deletions
0
helpers/__init__.py
Normal file
0
helpers/__init__.py
Normal file
25
helpers/logging_manager.py
Normal file
25
helpers/logging_manager.py
Normal 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
|
Loading…
Reference in a new issue