Commit 9ef5a2f3 authored by Stephen Thompson's avatar Stephen Thompson

Issue #3 changed handling of file close

parent 34cd23db
Pipeline #4451 failed with stages
in 5 minutes and 57 seconds
......@@ -51,10 +51,8 @@ class Logger():
self._logger.info(message)
def close(self):
def __del__(self):
"""Releases the log file"""
if self._no_logging:
return
self._logger.handlers[0].flush()
self._logger.handlers[0].close()
if not self._no_logging:
self._logger.handlers[0].flush()
self._logger.handlers[0].close()
......@@ -96,4 +96,4 @@ class OverlayApp(OverlayBaseApp):
def __del__(self):
self._logger.log(message="Closing overlay app")
self._logger.close()
del self._logger
......@@ -18,7 +18,7 @@ def test_empty_config():
logger = Logger(config)
logger.log(message="testing")
logger.close()
del logger
def test_non_empty_config():
......@@ -35,7 +35,7 @@ def test_non_empty_config():
logger.log(message="testing")
assert path.exists("sks_evaluation.log")
logger.close()
del logger
remove("sks_evaluation.log")
......@@ -55,5 +55,5 @@ def test_overwrite():
logger.log(message="testing")
assert path.exists("testing_log_file.log")
logger.close()
del logger
remove("testing_log_file.log")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment