make the path reference in logger more robust

This commit is contained in:
Mike Kelly 2023-04-14 12:32:33 +01:00
parent 98efd26456
commit 475edd3b40

View File

@ -24,7 +24,8 @@ For console handler: simulates typing
class Logger(metaclass=Singleton):
def __init__(self):
# create log directory if it doesn't exist
log_dir = os.path.join('..', 'logs')
this_files_dir_path = os.path.dirname(__file__)
log_dir = os.path.join(this_files_dir_path, '../logs')
if not os.path.exists(log_dir):
os.makedirs(log_dir)