From 6726be1551eecfc174c1b66db771778892402be6 Mon Sep 17 00:00:00 2001 From: Vasco Lameiras Date: Sat, 11 Dec 2021 03:18:35 +0000 Subject: [PATCH] Creates logs dir if it does not exist --- LimitSwap.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/LimitSwap.py b/LimitSwap.py index 310c9f4..352f4cd 100755 --- a/LimitSwap.py +++ b/LimitSwap.py @@ -87,6 +87,14 @@ def timestamp(): """"""""""""""""""""""""""" //ERROR LOGGING """"""""""""""""""""""""""" +os.makedirs('./logs', exist_ok=True) + +if not os.path.exists('./logs/errors.log'): + open('./logs/errors.log', 'w').close() + +if not os.path.exists('./logs/exceptions.log'): + open('./logs/exceptions.log', 'w').close() + log_format = '%(levelname)s: %(asctime)s %(message)s' logging.basicConfig(filename='./logs/errors.log', level=logging.INFO,