本文整理汇总了Python中ISLogger.Logger.log_debug_1方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.log_debug_1方法的具体用法?Python Logger.log_debug_1怎么用?Python Logger.log_debug_1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISLogger.Logger
的用法示例。
在下文中一共展示了Logger.log_debug_1方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __process_mq_msg
# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug_1 [as 别名]
def __process_mq_msg(self):
try:
msg = self.zc.zmq_recv(self.sock, 5000)
if not msg == None:
#Write to the sender Q
msg = json.loads(msg)
self.q_i_lock.acquire()
try:
Logger.log_debug_1('Adding a message to MPQ to be sent to cloud')
self.q_input.put(msg)
except Exception as ex:
Logger.log_debug('ERROR @ Job Scheduler -> __process_mq_msg() -> sending to Q')
Logger.log_error(str(ex))
finally:
self.q_i_lock.release()
self.sock.send(json.dumps({'error': False}))
except Exception as e:
Logger.log_debug('ERROR @ Job Notification_Sender_MQService -> __process_mq_msg()')
Logger.log_error(str(e))
finally:
pass
示例2: __send_invalid_com_ack
# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug_1 [as 别名]
def __send_invalid_com_ack(self, payload):
try:
Logger.log_debug_1('Invalid command type')
ack = cfg.ack_dict.copy()
ack.update({'comid': payload['comid'], 'comexecstat': 'DONE', 'comcompstat': 'FAILED', 'comresult':'Invalid com type'})
ack.update({'ack_dt': datetime.datetime.utcnow().isoformat(), 'error': True})
jack = json.dumps(ack)
self.sock.send(jack)
except Exception as e:
Logger.log_error(str(e))
示例3: __schedule_an_event
# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug_1 [as 别名]
def __schedule_an_event(self, payload):
ack = cfg.ack_dict.copy()
try:
#Connects to JS service Q
#zc = ZC()
js_sock = self.zc.connect_zmq(cfg.JS_SERVICE_IP, cfg.JS_SERVICE_PORT)
if not js_sock == None:
# Send the message to JS service Q and wait for the response
js_sock.send(json.dumps(payload), zmq.NOBLOCK)
ret_msg = None
ret_msg = self.zc.zmq_recv(js_sock)
js_sock.close()
del js_sock
# Process the response back from JS Service Q
# and send back the ACK to the message sender
if not ret_msg == None:
ret_msg =json.loads(ret_msg)
status = 'SUCCESS' if ret_msg['error'] == False else 'FAILED'
ack.update({'comid': payload['comid'], 'comexecstat': 'DONE', 'comcompstat': status, 'comresult': ret_msg['error_msg']})
ack.update({'ack_dt': datetime.datetime.utcnow().isoformat(), 'error': ret_msg['error']})
else:
ack.update({'comid': payload['comid'], 'comexecstat': 'DONE', 'comcompstat': 'FAILED', 'comresult':'No response from JS'})
ack.update({'ack_dt': datetime.datetime.utcnow().isoformat(), 'error': True})
Logger.log_debug_1('Sending ACK/NACK from MP')
self.sock.send(json.dumps(ack))
else:
Logger.log_debug_1('MP failed to connect with JS service')
ack.update({'comid': payload['comid'], 'comexecstat': 'DONE', 'comcompstat': 'FAILED', 'comresult':'Failed to connect with JS'})
ack.update({'ack_dt': datetime.datetime.utcnow().isoformat(), 'error': True})
self.sock.send(json.dumps(ack))
except Exception as e:
Logger.log_debug('ERROR @ Message_Processor -> __schedule_an_event()')
Logger.log_error(str(e))
ack.update({'comid': payload['comid'], 'comexecstat': 'DONE', 'comcompstat': 'FAILED', 'comresult':str(e)})
ack.update({'ack_dt': datetime.datetime.utcnow().isoformat(), 'error': True})
self.sock.send(json.dumps(ack))
示例4: run
# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug_1 [as 别名]
def run(self):
try:
Logger.log_info('Started PPID ' + str(self.parent_proc_id) + ' PID ' + str(os.getpid()))
while self.is_parent_alive():
msg = self.__read_q_msg()
if not msg == None:
#Send to the cloud
Logger.log_debug_1('Sending a message to cloud')
result = CF.send_to_cloud(msg)
if result[0]:
self.__save_sent_failed_notification(msg)
else:
self.__re_try_failed_notifications()
#pass
time.sleep(0.5)
except Exception as e:
Logger.log_debug('ERROR @ Notification_Sender_To_Cloud -> run()')
Logger.log_error(str(e))
示例5: __send_msg_to_serial_port
# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug_1 [as 别名]
def __send_msg_to_serial_port(self, msg):
try:
if not self.serial == None:
if not self.serial.isOpen():
#self.__connect_serial_interface()
self.serial.open()
Logger.log_debug_1('Writting to serial {}'.format(msg))
msg = msg + '~'
self.serial.write(msg)
self.last_msg_wrote_dt = datetime.datetime.now()
time.sleep(1)
self.serial.flush()
self.serial.close()
return True
else:
return False
except Exception as e:
Logger.log_debug("ERROR @ Serial_Interface -> __send_msg_to_serial_port()")
Logger.log_error(str(e))
return False
示例6: __process_mq_msg
# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug_1 [as 别名]
def __process_mq_msg(self):
ack = cfg.ack_dict.copy()
com_id = 0
try:
msg = self.zc.zmq_recv(self.sock, 15000)
if not msg == None:
payload = json.loads(msg)
else:
return
if not payload == None:
hub_id = payload['hubid']
com_id = payload['comid']
com_type =payload['comtype']
if com_type == 'EVE':
device_code = payload['devicecode']
if device_code == 'GPIOPIN':
self.__handle_gpio_coms(payload)
if device_code == 'RFLSWITCH' or device_code == 'RFPLSWITCH':
self.__handle_rf_command(payload)
else:
self.__send_invalid_com_ack(payload)
elif com_type == 'SAE':
Logger.log_debug_1('Processing an SAE message')
self.__schedule_an_event(payload)
elif com_type == 'DSR': # Deletion request of a scheduled event
Logger.log_debug_1('Processing an DSR message')
self.__schedule_an_event(payload)
elif com_type == 'SRE' or com_type == 'RRS': # Sensor Registration Event or removal event
self.__register_or_remove_rf_sensor(payload)
else:
self.__send_invalid_com_ack(payload)
except Exception as e:
try:
ack.update({'comid': com_id, 'comexecstat': 'DONE', 'comcompstat': 'FAILED', 'comresult':str(e)})
ack.update({'ack_dt': datetime.datetime.utcnow().isoformat(), 'error': True})
jack = json.dumps(ack)
Logger.log_debug('ERROR @ __process_mq_msg')
Logger.log_error(str(e))
self.sock.send(jack)
except Exception as e2:
Logger.log_error(str(e2))