Island: Remove IslandLogService

This commit is contained in:
Shreya Malviya 2022-08-01 13:34:56 +05:30
parent 977860efb2
commit 7a2ff04978
1 changed files with 0 additions and 30 deletions

View File

@ -1,30 +0,0 @@
import logging
logger = logging.getLogger(__name__)
class IslandLogService:
def __init__(self):
pass
@staticmethod
def get_log_file():
"""
This static function is a helper function for the monkey island log download function.
It finds the logger handlers and checks if one of them is a fileHandler of any kind by
checking if the handler
has the property handler.baseFilename.
:return:
a dict with the log file content.
"""
logger_handlers = logger.parent.handlers
for handler in logger_handlers:
if hasattr(handler, "baseFilename"):
logger.info("Log file found: {0}".format(handler.baseFilename))
log_file_path = handler.baseFilename
with open(log_file_path, "rt") as f:
log_file = f.read()
return {"log_file": log_file}
logger.warning("No log file could be found, check logger config.")
return None