当前位置: 首页>>代码示例>>Python>>正文


Python Logger.log_debug方法代码示例

本文整理汇总了Python中ISLogger.Logger.log_debug方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.log_debug方法的具体用法?Python Logger.log_debug怎么用?Python Logger.log_debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISLogger.Logger的用法示例。


在下文中一共展示了Logger.log_debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __handle_gpio_coms

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug [as 别名]
 def __handle_gpio_coms(self, payload = None):
     
     ack = cfg.ack_dict.copy()
     try:
         com_code = payload['comcode']
         gpio_pin = payload['gpiopinno']
         bcm_pin = payload['bcmgpiopinno']
         
         ret_val = False
         if com_code == 'ON':
             ret_val = gpio.make_gpio_pin_high(bcm_pin)
         else:
             ret_val = gpio.make_gpio_pin_low(bcm_pin)
             
         if ret_val:
             ack.update({'comid': payload['comid'], 'comexecstat': 'DONE', 'comcompstat': 'SUCCESS', 'comresult':''})
             ack.update({'ack_dt': datetime.datetime.utcnow().isoformat()})
         else:
             ack.update({'comid': payload['comid'], 'comexecstat': 'DONE', 'comcompstat': 'FAILED', 'comresult':'Failed gpio operation'})
             ack.update({'ack_dt': datetime.datetime.utcnow().isoformat()})
         
         Logger.log_debug('MP sending ack')
         self.sock.send(json.dumps(ack))
         
     except Exception as e:
         ack.update({'comid': payload['comid'], 'comexecstat': 'DONE', 'comcompstat': 'FAILED', 'comresult':str(e)})
         ack.update({'ack_dt': datetime.datetime.utcnow().isoformat(), 'error': True})
         jack = json.dumps(ack)
         self.sock.send(jack)
         Logger.log_debug('ERROR @ __handle_gpio_coms')
         Logger.log_error(str(e))
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:33,代码来源:MessageProcessor.py

示例2: __get_external_ip

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug [as 别名]
    def __get_external_ip(self):

        try:
            
            log.log_debug('Started checking external ip')
            """
            url = "http://checkip.dyndns.org"
            request = urllib.urlopen(url).read()
            the_ip = re.findall(r"\d{1,3}\.\d{1,3}\.\d{1,3}.\d{1,3}", request)
            """
            
            hub_sno = CF.get_hub_serial_no()
            for port in cfg.cloud_opened_ports_list:
                
                url = 'https://hub:%[email protected]%s:%s/node/what_is_my_ip' % (hub_sno, cfg.cloud_dns_name, port)
                
                try:
                    requests.packages.urllib3.disable_warnings()
                    resp = requests.put(url=url, verify=False, timeout=10)
                    resp_dict = json.loads(resp.text)
                    
                    #print resp_dict
                    if resp_dict['error'] == False:
                        return resp_dict['ip_address']
                    
                except Exception as e2:
                    log.log_error(str(e2))
                
            return ''

        except Exception as e:
            log.log_debug("ERROR @ get_external_ip")
            log.log_error(str(e))
            return ''
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:36,代码来源:ExtIPCNotifier.py

示例3: __process_mq_msg

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug [as 别名]
 def __process_mq_msg(self):
     ret_msg = {'error' : False}
     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 SIMPQ')
                 self.q_input.put(msg)
             
             except Exception as ex:
                 Logger.log_debug('ERROR @ SI_MQ_Service -> __process_mq_msg() -> sending to Q')
                 Logger.log_error(str(ex))
                 ret_msg.update({'error': True})
             finally:
                 self.q_i_lock.release()
                 self.sock.send(json.dumps(ret_msg))
                 
     except Exception as e:
         Logger.log_debug('ERROR @ SI_MQ_Service -> __process_mq_msg()')
         Logger.log_error(str(e))
     finally:
         pass
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:29,代码来源:SIMQService.py

示例4: __handle_RC_msgs

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug [as 别名]
 def __handle_RC_msgs(self, msg_line):
     
     try:
             
             # Load the device attributes file
             device_dict = self.__load_rfd_file(msg_line.split(':')[1])
             
             if not device_dict == None:
                 msg_dict = {'notification_type' : 'SERIAL_EVENT', 'notification_dt': datetime.datetime.now().strftime("%Y%m%d %H%M%S")}
                 msg_dict.update({'devicecode': device_dict['devicecode']})
                 msg_dict.update({'hubcondeviceid': device_dict['hubcondeviceid']})
                 msg_dict.update({'cronjobid' : 0})
                 msg_dict.update({'comcode' : 'AUTO_TRIGGER'})
                 msg_dict.update({'comexecstat' : 'DONE'})
                 msg_dict.update({'comcompstat': 'SUCCESS'})
                 msg_dict.update({'comresults' : ''})
                 
                 if device_dict['devicecode'] == 'SRFDOOR':
                     msg_dict.update({'comresult' : 'OPENED'})
                     
                 CF.send_to_notifiction_queue(msg_dict)
     
     except Exception as e:
         Logger.log_debug('ERROR @ Serial_Interface -> __handle_RC_msgs()')
         Logger.log_error(str(e))
         return None
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:28,代码来源:SerialInterface.py

示例5: schedule_a_job

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug [as 别名]
    def schedule_a_job(self, cronjobid, m="0",h='*',dow='*', message_dict=None):

        #-----------------------------------------
        # jobid format :- <device_com_pk><hub_pk>
        #-----------------------------------------
        ret_val = False
        #Jobs_Scheduler.__job_lock.acquire()
        try:

            if m>=0:

                #dict_obj={"jobid":jobid,"m":m,"h":h,"dow":dow}

                ret_val = True
                if not message_dict == None:
                    
                    file_name = '%s%s%s' % (cfg.SCHEDULED_JOBS_FILES_PATH, cronjobid , ".shed")
                    ret_val = CF.save_dictionary_object(file_name, message_dict)

                if ret_val:
                    #print 'adding a schedule'
                    Logger.log_info('Adding scheduler job ' + str(cronjobid))
                    self.__scheduler.add_job(Jobs_Scheduler.scheduler_callback_function
                                                       ,minute=m,hour=h,day_of_week=dow, id=cronjobid,trigger="cron",kwargs={"jobid":cronjobid})

            return ret_val
        except Exception as e:
            Logger.log_debug("ERROR @ schedule_a_job")
            Logger.log_error(str(e))
            return False
        finally:
            #Jobs_Scheduler.__job_lock.release()
            pass
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:35,代码来源:JobScheduler.py

示例6: print_jobs

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug [as 别名]
 def print_jobs(self):
     try:
         self.__scheduler.print_jobs()
     
     except Exception as e:
         Logger.log_debug("ERROR @ print_jobs")
         Logger.log_error(str(e))
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:9,代码来源:JobScheduler.py

示例7: scheduler_callback_function

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug [as 别名]
    def scheduler_callback_function(jobid):

        Jobs_Scheduler.__lock_sending_to_msg_q.acquire()
        try:
            
            jobid = str(jobid)
            
            Logger.log_info("Scheduler triggered for job "+ jobid)
            file_path = cfg.SCHEDULED_JOBS_FILES_PATH
            file_name = file_path + jobid + ".shed"

            dict_msg = CF.load_dictionary_object(file_name)

            if not dict_msg == None:

                # Send the message to MessageProc q
                result_msg = Jobs_Scheduler.send_job_command(dict_msg)
                
        except Exception as e:
            Logger.log_debug("ERROR @ scheduler_callback_function")
            Logger.log_error(str(e))

        finally:
            Logger.log_debug("End of scheduler_callback_function")
            Jobs_Scheduler.__lock_sending_to_msg_q.release()
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:27,代码来源:JobScheduler.py

示例8: load_properties

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug [as 别名]
    def load_properties(self):

        try:

            self.__dict_props={}
            file_obj=open(self.property_file_name,'r')

            for line in file_obj:
                line=line.strip()

                if not line=='':
                    if not line.startswith("#"):
                        lst=line.split(self.delimiter,1)

                        #prop_name=line.split(self.delimiter,1)[0].strip()
                        #prop_val=line.split(self.delimiter)[1].strip()

                        prop_name=lst[0]
                        prop_value=""
                        if len(lst)>1:
                            prop_val=lst[1]


                        self.__dict_props.update({prop_name:prop_val})

            file_obj.close()
            return True

        except Exception as e:
            log.log_debug("ERROR @ load_properties")
            log.log_error(str(e))
            return False
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:34,代码来源:RWProps.py

示例9: add_remove_ufw_rule

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug [as 别名]
 def add_remove_ufw_rule(self, add_rule = True, port = "0", ip_address = ""):
     
     try:
         if int(port) > 0 and len(ip_address)>0:
             
             if add_rule:
                 if self.get_existing_rule_id(ip_address, port) <= 0:
                     #args_list = ['echo', 'y', '|', 'sudo','ufw','allow', 'from', ip_address, 'to', 'any', 'port', port]
                     #return CF.execute_os_function(args_list)
                     result = os.system('echo y | sudo ufw allow from %s to any port %s' % (ip_address, port))
                     
                     return (0,result)
                 else:
                     return (0, '')
             else:
                
                 id = self.get_existing_rule_id(ip_address, port)
                 print 'id is ' + str(id)
                 if id>0:
                     #args_list = ['echo', 'y','|', 'sudo', 'ufw', 'delete', str(id)]
                     result = os.system('echo y | sudo ufw delete %s' % (id))
                     #return CF.execute_os_function(args_list)
                     return (0, result)
                 else:
                     return(0,'')
         else:
             return (0,'')
         
     except Exception as e:
         Logger.log_debug('ERROR @ add_remove_ufw_rule')
         Logger.log_error(str(e))
         return (0,'')
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:34,代码来源:ufw_rules_updator.py

示例10: allow_cloud_ip

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug [as 别名]
 def allow_cloud_ip(self):
     # This function allows the cloud ip from UFW
     # Will remove any old ips of cloud dns
     try:
             
             new_cloud_ip = socket.gethostbyname(cfg.cloud_dns_name)
             old_cloud_ip = CF.load_dictionary_object(script_path + "cloud_ip")
             
             if old_cloud_ip == None:
                 # Create a dictionary and add a new rule
                 #---------------------------------------
                 dict = {'cloud_ip':new_cloud_ip,'port':cfg.hub_opened_port, 'last_updated_date' : datetime.utcnow().isoformat()}
                 self.add_remove_ufw_rule(True, str(cfg.hub_opened_port), new_cloud_ip)
                 
                 CF.save_dictionary_object(script_path + "cloud_ip", dict)
                 
             else:
                 # update rule and update ip file
                 #-------------------------------
                 
                 if not (new_cloud_ip + str(cfg.hub_opened_port)) == (old_cloud_ip['cloud_ip'] + str(old_cloud_ip['port'])) :
                     self.add_remove_ufw_rule(False, str(old_cloud_ip['port']), old_cloud_ip['cloud_ip'])
                     self.add_remove_ufw_rule(True, str(cfg.hub_opened_port), new_cloud_ip)
                     dict = {'cloud_ip':new_cloud_ip, 'port':cfg.hub_opened_port, 'last_updated_date' : datetime.utcnow().isoformat()}
                     CF.save_dictionary_object(script_path + "cloud_ip", dict)
             
     except Exception as e:
         
         Logger.log_debug('ERROR @ Update_UFW_Rules -> update_server_rule')
         Logger.log_error(str(e))
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:32,代码来源:ufw_rules_updator.py

示例11: __process_mq_msg

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug [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
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:27,代码来源:NotificationSenderMQService.py

示例12: __init_mq_server

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug [as 别名]
 def __init_mq_server(self):
     try:
         context = zmq.Context()
         self.sock = context.socket(zmq.REP)
         self.sock.setsockopt(zmq.LINGER, 15000)
         self.sock.bind('tcp://%s:%s' % (cfg.msg_proc_ip, cfg.msg_proc_port))
     except Exception as e:
         Logger.log_debug('ERROR @ Message_Processor -> __init_mq_server')
         Logger.log_error(str(e))
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:11,代码来源:MessageProcessor.py

示例13: __start_si_mp

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug [as 别名]
 def __start_si_mp(self):
     try:
         
         p = SI('si', self.q_input, self.q_i_lock, os.getpid())
         p.start()
         
     except Exception as e:
         Logger.log_debug('ERROR @ SI_MQ_Service -> __start_si_mp()')
         Logger.log_error(str(e))
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:11,代码来源:SIMQService.py

示例14: __start_sender_mp

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug [as 别名]
 def __start_sender_mp(self):
     try:
         
         p = NSTC('ntsc', self.q_input, self.q_i_lock, os.getpid())
         p.start()
         
     except Exception as e:
         Logger.log_debug('ERROR @ Notification_Sender_MQService -> __start_sender_mp()')
         Logger.log_error(str(e))
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:11,代码来源:NotificationSenderMQService.py

示例15: __save_sent_failed_notification

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_debug [as 别名]
 def __save_sent_failed_notification(self, msg_dict):
     try:
         
         msg_dict.update({'last_sent_failed_dt': datetime.datetime.now().isoformat()})
         path = cfg.SENT_FAILED_NOTIFICATIONS_FILE_PATH
         file_name = '{}{}.{}'.format(path, datetime.datetime.now().strftime('%Y%m%d%H%M%S%f'), 'sfn')
         CF.save_dictionary_object(file_name, msg_dict)
     except Exception as e:
         Logger.log_debug('ERROR @ Notification_Sender_To_Cloud -> __save_sent_failed_notification()')
         Logger.log_error(str(e))
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:12,代码来源:NotificationSenderToCloud.py


注:本文中的ISLogger.Logger.log_debug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。