3
2
forked from Dniel97/artemis

index.py: Fix log directory creation

This commit is contained in:
Hay1tsme 2023-03-09 19:03:30 -05:00
parent 57ecff641a
commit f283dd10a9

View File

@ -163,6 +163,9 @@ if __name__ == "__main__":
if path.exists(f"{args.config}/core.yaml"):
cfg.update(yaml.safe_load(open(f"{args.config}/core.yaml")))
if not path.exists(cfg.server.log_dir):
mkdir(cfg.server.log_dir)
logger = logging.getLogger("core")
log_fmt_str = "[%(asctime)s] Core | %(levelname)s | %(message)s"
log_fmt = logging.Formatter(log_fmt_str)
@ -182,9 +185,6 @@ if __name__ == "__main__":
logger.setLevel(log_lv)
coloredlogs.install(level=log_lv, logger=logger, fmt=log_fmt_str)
if not path.exists(cfg.server.log_dir):
mkdir(cfg.server.log_dir)
if not access(cfg.server.log_dir, W_OK):
logger.error(
f"Log directory {cfg.server.log_dir} NOT writable, please check permissions"