1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2025-02-13 09:44:40 +00:00

FIX: Fix for log_dir error on startup when log_dir is not set in the config.ini - either due to new startup or was set to None

This commit is contained in:
evilhero 2018-05-11 12:34:41 -04:00
parent 58b59d49bf
commit 4314b8b98c
2 changed files with 35 additions and 23 deletions

View file

@ -500,6 +500,17 @@ class Config(object):
self.provider_sequence()
if startup is True:
if self.LOG_DIR is None:
self.LOG_DIR = os.path.join(mylar.DATA_DIR, 'logs')
if not os.path.exists(self.LOG_DIR):
try:
os.makedirs(self.LOG_DIR)
except OSError:
if not mylar.QUIET:
self.LOG_DIR = None
print('Unable to create the log directory. Logging to screen only.')
# Start the logger, silence console logging if we need to
if logger.LOG_LANG.startswith('en'):
logger.initLogger(console=not mylar.QUIET, log_dir=self.LOG_DIR, max_logsize=self.MAX_LOGSIZE, max_logfiles=self.MAX_LOGFILES, loglevel=mylar.LOG_LEVEL)

View file

@ -77,6 +77,7 @@ if not LOG_LANG.startswith('en'):
lg = logging.getLogger('mylar')
lg.setLevel(logging.DEBUG)
if log_dir is not None:
self.filename = os.path.join(log_dir, self.filename)
#concurrentLogHandler/0.8.7 (to deal with windows locks)