Island: Return Path in get_log_file_path() instead of str

This commit is contained in:
Shreya Malviya 2022-08-01 13:25:30 +05:30
parent 8da12a7970
commit 24aea69220
1 changed files with 2 additions and 2 deletions

View File

@ -66,7 +66,7 @@ def reset_logger():
logger.removeHandler(handler)
def get_log_file_path() -> Optional[str]:
def get_log_file_path() -> Optional[Path]:
"""
Finds the log file by finding the logger handlers and checking if one of them is a fileHandler
of any kind by checking if the handler has the property handler.baseFilename.
@ -81,7 +81,7 @@ def get_log_file_path() -> Optional[str]:
if hasattr(handler, "baseFilename"):
logger.info("Log file found: {0}".format(handler.baseFilename))
log_file_path = handler.baseFilename
return log_file_path
return Path(log_file_path)
logger.warning("No log file could be found, check logger config.")
return None