Commit afe42478 by mohammed.shibili

corrections done

parent beced782
from paho.mqtt import client as mqtt
from script.config.appconf import mqtt_broker, mqtt_port, mqtt_time
from script.logging.loggers import logger
def mqtt_conn():
......@@ -10,4 +11,5 @@ def mqtt_conn():
print("mqtt connected")
return mqtt_
except Exception as e:
logger.exception(e)
print("mqtt fail", e)
......@@ -31,8 +31,6 @@ class Consultancy:
# decoding keys in redis
decoded_keys = [values.decode() for values in keys]
topic = ''
# print(Consultancy().doctors_list)
# print(Consultancy.self.current_doctor)
# checking whether patient is consulted before
for patient_id in decoded_keys:
# if patient is consulted before assign him to previous doctor
......
import redis
from script.config.appconf import redis_host, redis_port
from script.logging.loggers import logger
def redis_connection():
......@@ -11,4 +12,5 @@ def redis_connection():
return redis_conn
except Exception as e:
logger.exception(e)
print("redis connection fail", e)
import logging
import os
from logging.handlers import RotatingFileHandler
def get_logger():
# creating rotating logging
__logger__ = logging.getLogger('')
__logger__.setLevel(logging.INFO)
file_path = "script/logging/"
formatter = logging.Formatter('%(asctime)s - %(levelname)-6s - %(message)s', "%Y-%m-%d %H:%M:%S")
log_file = os.path.join(f"{file_path}exceptions.log")
temp_handler = RotatingFileHandler(log_file, maxBytes=1, backupCount=10)
temp_handler.setFormatter(formatter)
__logger__.addHandler(temp_handler)
return __logger__
logger = get_logger()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment