From f283dd10a9143af125594439af40c8c7f4c717ac Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Thu, 9 Mar 2023 19:03:30 -0500 Subject: [PATCH] index.py: Fix log directory creation --- index.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.py b/index.py index d30d51f..fba6d11 100644 --- a/index.py +++ b/index.py @@ -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"