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


Python Logger.log_info方法代码示例

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


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

示例1: schedule_a_job

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_info [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

示例2: scheduler_callback_function

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_info [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

示例3: run

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_info [as 别名]
 def run(self):
     try:
         Logger.log_info('ZMQ server for IS started.')
         while True:
             time.sleep(0.5)
             self.__process_mq_msg()
     
     except Exception as e:
         Logger.log_debug('ERROR @ SI_MQ_Service -> run()')
         Logger.log_error(str(e))
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:12,代码来源:SIMQService.py

示例4: __init_scheduler

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_info [as 别名]
 def __init_scheduler(self):
     try:
         
         self.__scheduler = BackgroundScheduler()
         self.__load_scheduled_jobs()
         
     except Exception as e:
         Logger.log_debug('ERROR @ Job_Scheduler -> __init_scheduler')
         Logger.log_error(str(e))
     finally:
         Logger.log_info('Done with initializing job scheduler service')
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:13,代码来源:JobScheduler.py

示例5: __init_zmq_server

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

        try:
            context = zmq.Context()
            self.sock = context.socket(zmq.REP)
            self.sock.setsockopt(zmq.LINGER, 5000)
            self.sock.bind('tcp://%s:%s' % (cfg.JS_SERVICE_IP, cfg.JS_SERVICE_PORT))
            
        except Exception as e:
            Logger.log_debug('ERROR @ Job JS_MQ_Service -> __init_mq_server')
            Logger.log_error(str(e))
        finally:
            Logger.log_info('ZMQ server for JS initialized')
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:15,代码来源:JSMQService.py

示例6: __init_zmq_server

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

        try:
            
            Logger.log_info("Initiating Notification Sender MQService")
            context = zmq.Context()
            self.sock = context.socket(zmq.REP)
            self.sock.setsockopt(zmq.LINGER, 2000)
            self.sock.bind('tcp://%s:%s' % (cfg.NOTIFICATION_SERVICE_IP, cfg.NOTIFICATION_SERVICE_PORT))
            
            return True
        except Exception as e:
            Logger.log_debug('ERROR @ Job Notification_Sender_MQService -> __init_zmq_server')
            Logger.log_error(str(e))
            return False
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:17,代码来源:NotificationSenderMQService.py

示例7: __register_or_remove_rf_sensor

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_info [as 别名]
 def __register_or_remove_rf_sensor(self, payload = None):
     
     ack = cfg.ack_dict.copy()
     
     try:
         com_type = payload['comtype']
         devicesno = payload['devicesno']
         devicecode = payload['devicecode']
         reg_dt = datetime.datetime.now().isoformat()
         hubcondeviceid =payload['hubcondeviceid']
         
         file_path = cfg.REGISTERED_DEVICES_RECORDS_PATH
         file_name = '{}{}.{}'.format(file_path, devicesno, 'rfd')
         
         ret_val = False
         if com_type == 'SRE':
             
             Logger.log_info("Registering a new RF device {}".format(devicesno))
             record_dict = {'devicesno': devicesno, 'devicecode': devicecode, 'reg_dt': reg_dt, 'hubcondeviceid': hubcondeviceid}
             ret_val = CF.save_dictionary_object(file_name , record_dict)
             
         elif com_type == 'RRS':
             # remove registered sensor
             Logger.log_info("Removing a registered sensor {}".format(devicesno))
             os.remove(file_name)
             
             ret_val = True
             
         #Construct ack and send back
         if ret_val:
             
             # Construct an ack
             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 to register'})
             ack.update({'ack_dt': datetime.datetime.utcnow().isoformat()})
         
         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 @ __register_or_remove_rf_sensor')
         Logger.log_error(str(e))
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:49,代码来源:MessageProcessor.py

示例8: __connect_serial_interface

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_info [as 别名]
 def __connect_serial_interface(self):
     try:
         
         if not self.serial == None:
             del self.serial
             self.serial = None
         
         Logger.log_info("Connecting to serial port")
         self.serial = serial.Serial(port=cfg.SERIAL_PORT_NAME, baudrate=9600
                                   , parity=serial.PARITY_NONE
                                   , stopbits=serial.STOPBITS_ONE, timeout=0, bytesize=serial.EIGHTBITS)
         
         
         time.sleep(3) #Wait until arduino resets
         
         return True
     except Exception as e:
         Logger.log_debug("ERROR @ Serial_Interface -> __connect_serial_interface")
         Logger.log_error(str(e))
         return False
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:22,代码来源:SerialInterface.py

示例9: run

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

示例10: run

# 需要导入模块: from ISLogger import Logger [as 别名]
# 或者: from ISLogger.Logger import log_info [as 别名]
 def run(self):
     
     try:
         Logger.log_info('Serial Interface Started - PPID ' + str(self.parent_proc_id) + ' PID ' + str(os.getpid()))
         
         while self.is_parent_alive():
             
             try:
                 msg = None
                 
                 elapsed_seconds = (datetime.datetime.now() - self.last_msg_wrote_dt).total_seconds()
                 if elapsed_seconds >= cfg.SI_WAIT_SECONDS_AFTER_SENDING_A_MSG:
                     msg = self.__read_q_msg()
                     
                 gpio_pin_no = ''
                 dev_code = ''
                 
                 # Send the message to the serial interface
                 # -----------
                 if not msg == None:
                     #Send to the serial port
                     #Logger.log_debug_1('Processing serial message @ SI')
                     
                     gpio_pin_no = str(msg['gpiopinno']).zfill(2)
                     gpio_pin_no = msg['analogordigitalpin'] + gpio_pin_no
                     dev_code = msg['devicecode']
                     
                     self.__com_sno += 1
                     if self.__com_sno >= 999:
                         self.__com_sno = 1
                         
                     com_id = str(self.__com_sno).zfill(3)
                     command_msg = '{}{}{}{}'.format(com_id, msg['devicesno'],gpio_pin_no, msg['comcode'], msg['hubid'])
                     
                     
                     self.__dict_coms_waiting_for_ack.update({self.__com_sno:(command_msg, datetime.datetime.now(), msg['comid'], msg['hubid'],msg['u_or_s'],msg)})
                     result = self.__send_msg_to_serial_port(command_msg)
                     
                     if not result:
                         # Send NACK immediately to the notification Q
                         self.__handle_ack_msg(self.__com_sno, 'DONE', 'FAILED', 'FailedReason~failed to transmit at hub')
                     
                 #=================================
                 #Read any incoming serial message
                 #---------------------------------
                 in_msg = self.__read_msg_from_serial_port()
                 
                 if len(in_msg) > 0:
                     send_to_notification = False
                     
                     #Check whether the message had been send to the notification Q already
                     #-------------
                     if in_msg in self.__dict_incoming_serial_msgs:
                         msg_last_dt = self.__dict_incoming_serial_msgs[in_msg]
                         if (datetime.datetime.now() - msg_last_dt).total_seconds() > cfg.RC_DEVICE_NOTIFICATION_REPEAT_GAP_SECONDS:
                             self.__dict_incoming_serial_msgs[in_msg] = datetime.datetime.now()
                             # Send the message to notification Q
                             send_to_notification = True
                     else:
                         self.__dict_incoming_serial_msgs.update({in_msg:datetime.datetime.now()})
                         send_to_notification = True
                     
                     # STart sending to notification Q
                     #-------------------------------
                     if send_to_notification:
                 
                         if in_msg.startswith("RC:"):
                             
                             self.__handle_RC_msgs(in_msg)
                                     
                         elif in_msg.startswith('ACK:'):
                             
                             in_msg = in_msg.replace('~', '').replace('ACK:','')
                             si_com_sno = int(in_msg[0:3])
                             
                             if si_com_sno in self.__dict_coms_waiting_for_ack:
                                 
                                 comp_status = 'FAILED' if in_msg.endswith('NACK') else 'SUCCESS'
                                 exec_status = 'DONE'
                                 com_results = 'FailedReason~failed to execute' if comp_status == 'FAILED' else ''
                                 
                                 self.__handle_ack_msg(si_com_sno, exec_status, comp_status, com_results)
                                 del self.__dict_coms_waiting_for_ack[si_com_sno]
                             
                         else:
                             #Send the message to the notification q immediately
                             pass
                         
                 # TIMEOUT any command wating for an ACK.
                 #----------------------------------------
                 m_w_s = cfg.SI_MAX_WAIT_SECONDS_FOR_ACK
                 to_del = []
                 
                 for key, val in self.__dict_coms_waiting_for_ack.items():
                     com_dt = val[1]
                     curr_dt = datetime.datetime.now()
                     diff_s = (curr_dt-com_dt).total_seconds()
                     
                     if diff_s > m_w_s:
                         
#.........这里部分代码省略.........
开发者ID:shanfdo,项目名称:iSensa_v3,代码行数:103,代码来源:SerialInterface.py


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