Make sure logs exist

This commit is contained in:
573Dev 2021-04-18 15:11:14 -05:00 committed by 573dev
parent d2ff78b22a
commit fed37998ad

View File

@ -35,8 +35,19 @@ class RequestFormatter(logging.Formatter):
return super().format(record)
def make_log(path):
if not path.exists() and not path.is_file():
with path.open("a") as f:
f.write("")
# Define the logger
LOG_PATH = Path(__file__).parent.parent / "logs"
LOG_PATH.mkdir(parents=True, exist_ok=True)
make_log(LOG_PATH / "debug.log")
make_log(LOG_PATH / "requests.log")
make_log(LOG_PATH / "all.log")
make_log(LOG_PATH / "werkzeug.log")
dictConfig(
{
"version": 1,