Merge pull request #1312 from mikekelly/more-robust-log-dir-path

More robust log dir path
This commit is contained in:
Richard Beales
2023-04-14 17:11:56 +01:00
committed by GitHub
2 changed files with 3 additions and 1 deletions

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)