From 4ce6a2fff483d9d43b137802225dc520151cae45 Mon Sep 17 00:00:00 2001 From: Gleb Mikhaylov Date: Tue, 27 Aug 2019 13:55:12 +0300 Subject: [PATCH] =?UTF-8?q?=D1=83=D0=B1=D1=80=D0=B0=D0=BB=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BF=D0=B8=D1=81=D1=8C=20=D0=BB=D0=BE=D0=B3=D0=B0=20=D0=BD?= =?UTF-8?q?=D0=B0=D0=BF=D1=80=D1=8F=D0=BC=D1=83=D1=8E=20=D0=B2=20=D1=84?= =?UTF-8?q?=D0=B0=D0=B9=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/payment/tasks.py | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/apps/payment/tasks.py b/apps/payment/tasks.py index 60592ff7..20046e85 100644 --- a/apps/payment/tasks.py +++ b/apps/payment/tasks.py @@ -71,19 +71,14 @@ def transaction_to_roistat(user_id, payment_id, event_name, amount, time, status except: resp_json = None - with open("/app/media/roistat.log", "a") as text_file: - - if resp.status_code != 200 or not resp_json or not resp_json.get('processed'): - logger.error('TRANSACTION_TO_ROISTAT for payment # %d, %s RUB: %s' % ( - payment_id, amount, resp.text)) - logger_roistat.debug('TRANSACTION_TO_ROISTAT for payment # %d, %s RUB: %s' % ( - payment_id, amount, resp.text)) - - text_file.write(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + ' TRANSACTION_TO_ROISTAT for payment # %d, %s RUB: %s \n' % ( - payment_id, amount, resp.text)) - else: - logger.info('TRANSACTION_TO_ROISTAT: ' + str(resp.text)) - logger_roistat.debug('TRANSACTION_TO_ROISTAT: ' + str(resp.text)) - - text_file.write(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + ' TRANSACTION_TO_ROISTAT for payment # %d, %s RUB: %s \n' % ( - payment_id, amount, resp.text)) + if resp.status_code != 200 or not resp_json or not resp_json.get('processed'): + logger.error('TRANSACTION_TO_ROISTAT for payment # %d, %s RUB: %s' % ( + payment_id, amount, resp.text)) + + logger_roistat.debug('TRANSACTION_TO_ROISTAT for payment # %d, %s RUB: %s' % ( + payment_id, amount, resp.text)) + else: + logger.info('TRANSACTION_TO_ROISTAT: ' + str(resp.text)) + + logger_roistat.debug('TRANSACTION_TO_ROISTAT for payment # %d, %s RUB: %s' % ( + payment_id, amount, resp.text))