From 409381b5db07baddec8aa40dd91c0abed9820a0e Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sun, 22 Mar 2020 20:01:18 +0100 Subject: [PATCH] Better error handling (2) --- connectors.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/connectors.py b/connectors.py index 0aedf80..4152de1 100644 --- a/connectors.py +++ b/connectors.py @@ -4,6 +4,7 @@ from abc import ABC, abstractmethod from datetime import datetime, timedelta from enum import Enum from functools import wraps +from logging import getLogger from subprocess import run from sys import platform from urllib.parse import quote @@ -148,7 +149,7 @@ class Connector(ABC): output = '' http_code = 500 if IS_DEBUG: - print(e) + getLogger().exception(e) else: if ajax: headers = {'X-Requested-With': 'XMLHttpRequest'} @@ -167,7 +168,7 @@ class Connector(ABC): output = '' http_code = 500 if IS_DEBUG: - print(e) + getLogger().exception(e) return {'http_code': http_code, 'output': output}