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


Python Logger.log_error方法代码示例

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


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

示例1: start

# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_error [as 别名]
 def start(self):
     '''
     Initialize all services required by automation app.
     '''
     MethodController.instance() # Must listen to groups and methods added event before bootstrap.
     
     # Bootstrap
     try:
         bs = BootstrapService()
         Logger.log_info("Bootstrap update kbx method ...")
         bs.update_kbx_method()
         Logger.log_info("Bootstrap update kbx group ...")
         bs.update_kbx_group()
         Logger.log_info("Bootstrap register trigger schedulers ...")
         bs.register_trigger_schedulers()
         Logger.log_info("Bootstrap register timer module schedulers ...")
         bs.register_timer_module_schedulers()
     except Exception as e:
         bs.rollback()
         Logger.log_error("AutomationModuleWrapper.start bootstrap ex:", e)
         traceback.print_exc()
         raise e
     else:
         bs.commit()
         Logger.log_info("Bootstrap process completed!")
     
     self.__apiService = APIService()
     self.__ruleService = RuleService()
     self.__sceneService = SceneService()
     self.__serService = SceneExecutionResultService.instance()
开发者ID:TheStackBox,项目名称:xuansdk,代码行数:32,代码来源:automationModuleWrapper.py

示例2: rollback

# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_error [as 别名]
 def rollback(self):
     with self.__rlock:
         try:
             return self.__con.rollback()
         except Exception as e:
             Logger.log_error("Database.rollback ex:", e)
             traceback.print_exc()
开发者ID:TheStackBox,项目名称:xuansdk,代码行数:9,代码来源:database.py

示例3: commit

# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_error [as 别名]
 def commit(self):
     with self.__rlock:
         try:
             return self.__con.commit()
         except Exception as e:
             Logger.log_error("Database.commit ex:", e)
             traceback.print_exc()
开发者ID:TheStackBox,项目名称:xuansdk,代码行数:9,代码来源:database.py

示例4: delete_favorited_scene

# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_error [as 别名]
 def delete_favorited_scene(self, sceneId):
     '''
     sceneId - must be a favorited scene.
     '''
     with self.__fav_lock:
         try:
             favSort = self.__sceneController.get_favsort_of(sceneId)
         except Exception as e:
             raise AutomationException(11092, "prevSceneId does not belongs to any scene - " + \
                                             "prevSceneId provided: " + str(sceneId) + ", error: " + str(e))
         else:
             if favSort is None:
                 raise AutomationException(13000, "sceneId does not belongs to any favorited scene - " + \
                                                 "sceneId provided: " + str(sceneId))
         
         # This method raise error and rollback automatically if failed, or commit once succeed.
         try:
             self.__sceneController.delete_favorited_scene(sceneId)
             self.__sceneController.commit()
         except Exception as e:
             self.__sceneController.rollback()
             Logger.log_error("SceneService.delete_favorited_scene failed to delete favorited scene, ex:", str(e))
             raise AutomationException(13002, "unexpected error: " + str(e))
         
         #Broadcast event
         self.__broadcast_message__scene_updated(sceneId)
         self.__broadcast_message__favorited_scene_deleted(sceneId)
开发者ID:TheStackBox,项目名称:xuansdk,代码行数:29,代码来源:sceneService.py

示例5: __update_rule

# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_error [as 别名]
 def __update_rule(rule):
     try:
         # Fire rule update start event
         ruleId = rule["ruleId"]
         
         # Add methods to subscribe list
         methodIds = [kbxMethod["kbxMethodId"] for kbxMethod in rule["condition"] + rule["execution"]]
         self.__methodController.add(methodIds)
         
         # Update "rule" base table
         self.__ruleController.update(rule)
         self.__ruleController.commit()
     
     except Exception as e:
         self.__ruleController.rollback()
         self.__broadcast_message__rule_update_failed(ruleId, ruleName)
         Logger.log_error("RuleService __update_rule failed:", e, "-- rolledback")
     else:
         self.__triggerController.register_listener(ruleId, rule["trigger"])
         
         # Process for Timer Module
         TimerModule.delete_scheduler(ruleId)
         
         timerModuleHandlers = {TimerModule.METHOD_ID_DATE_TIME_RANGE:TimerModule.handle_date_time_range,
                                TimerModule.METHOD_ID_DAY_OF_WEEK:TimerModule.handle_dow,
                                TimerModule.METHOD_ID_TIME_RANGE:TimerModule.handle_time_range}
         
         for kbxMethod in rule["condition"]:
             kbxMethodId = kbxMethod["kbxMethodId"]
             timerModuleHandler = timerModuleHandlers.get(kbxMethodId, None)
             if timerModuleHandler is not None:
                 timerModuleHandler(ruleId, kbxMethod["kbxMethodParams"])
             
         # Broadcast message: completed updating a rule
         self.__broadcast_message__rule_updated(ruleId)
开发者ID:TheStackBox,项目名称:xuansdk,代码行数:37,代码来源:ruleService.py

示例6: __date_time_range

# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_error [as 别名]
 def __date_time_range(self, request):
     try:
         dtVal = request.get_value(TimerModule._PARAM_DT_RANGE.get_kbx_param_name())
         startDateTime = dtVal.get_start_date_time()
         endDateTime = dtVal.get_end_date_time()
         
         execTime = request.get_arg(AppConstants.KEY_CONDITION_TIMESTAMP)
         execTime = int(execTime)
         
         if execTime > endDateTime:
             # Allow a time delta of 59 seconds
             response = bool(abs(execTime - endDateTime) <= 59)
         else:
             response =  bool(startDateTime <= execTime <= endDateTime)
         
         if not response:
             raise AutomationException(11800)
             
         self.send_response({}, request.requestId)
     except AutomationException as ae:
         Logger.log_error("TimerModule date_time range failed on comparison:", str(ae))
         self.send_response({}, request.requestId, ae.get_error_code(), ae.get_error_message())
     except Exception as e:
         Logger.log_error("TimerModule date_time range failed on comparison (unexpected):", str(e))
         ae = AutomationException(11099, str(e))
         self.send_response({}, request.requestId, ae.get_error_code(), ae.get_error_message())
开发者ID:TheStackBox,项目名称:xuansdk,代码行数:28,代码来源:timerModule.py

示例7: list_groups

# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_error [as 别名]
    def list_groups(self, language, section, parentId=None):
        try:
            def sort_group_list(value):
                name = value.get("kbxGroupLabel")
                if name is None:
                    return ""
                else:
                    return str(name).lower()
                
            
            unknownGroupDict = {}
            unknownGroupId = self.__get_group_ids()
                
            parentId = AppConstants.GROUP_ID_AUTOMATION if parentId is None else parentId

            result = SharedMethod.list_shared_method_groups(kbxGroupParentId=parentId, kbxMethodTag=section,
                                                            enableTagCount=True, language=language)
            
            groupList = result["groupList"]
            
            # Level 1 groups which contain of SERVICES and LOCATIONS.
            if parentId == AppConstants.GROUP_ID_AUTOMATION:
                services = deque()
                groups =  deque()
                
                for groupDict in groupList:
                    kbxGroupId = groupDict["kbxGroupId"]
                    
                    # Add indicator for UI
                    groupDict["kbxGroupHasChild"] = True

                    # Reordering
                    if kbxGroupId == AppConstants.GROUP_ID_NOTIFICATION:
                        groupDict["kbxGroupDesc"] = KBXLang("group_notification_" + section)
                        services.appendleft(groupDict)
                    elif kbxGroupId == AppConstants.GROUP_ID_SERVICE:
                        groupDict["kbxGroupDesc"] = KBXLang("group_service_" + section)
                        services.append(groupDict)
                    elif kbxGroupId == unknownGroupId:
                        #append the group dict
                        unknownGroupDict = groupDict
                    else:
                        groups.append(groupDict)
                groups = sorted(groups, key=sort_group_list)
                if len(unknownGroupDict) > 0:
                    groups.append(unknownGroupDict)
                services.extend(groups)
                groupList = services
                parentGroup = None
                
            # Level 2 groups which are DEVICES or SERVICES.
            else:
                parentGroup = SharedMethod.get_shared_method_group_by_id(kbxGroupId=parentId, language=language)

            return parentGroup, groupList

        except Exception as e:
            Logger.log_error("APIService.list_groups ex:", e)
            raise AutomationException(11601, "Unexpected error - " + str(e))
开发者ID:TheStackBox,项目名称:xuansdk,代码行数:61,代码来源:apiService.py

示例8: enable_rule

# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_error [as 别名]
 def enable_rule(self, ruleId, enabled):
     self.__check_rule_process_status(ruleId)
     try:
         self.__ruleController.enable(ruleId, enabled)
         self.__ruleController.commit()
     except Exception as e:
         self.__ruleController.rollback()
         Logger.log_error("RuleService enable_rule ex:", e, "-- rolled back")
     else:
         self.__broadcast_message__rule_updated(ruleId)
开发者ID:TheStackBox,项目名称:xuansdk,代码行数:12,代码来源:ruleService.py

示例9: __on_shared_method_updated

# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_error [as 别名]
 def __on_shared_method_updated(self, eventObject):
     '''
     Triggered based on event broadcasted by system app.
     '''
     try:
         kbxMethod = json.loads(eventObject["eventData"]) # eventData = kbxMethod
         self.update(kbxMethod)
     except Exception as e:
         Logger.log_error("MethodController.__on_shared_method_updated ex:", e)
         traceback.print_exc()
开发者ID:TheStackBox,项目名称:xuansdk,代码行数:12,代码来源:methodController.py

示例10: delete_rule

# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_error [as 别名]
 def delete_rule(self, ruleId):
     self.__check_rule_process_status(ruleId)
     try:
         self.__ruleController.delete(ruleId)
         self.__ruleController.commit()
     except Exception as e:
         self.__ruleController.rollback()
         Logger.log_error("RuleService delete_rule ex:", e, "-- rolled back")
     else:
         self.__broadcast_message__rule_deleted(ruleId)
         self.__triggerController.unregister_listener(ruleId)
         TimerModule.delete_scheduler(ruleId)
开发者ID:TheStackBox,项目名称:xuansdk,代码行数:14,代码来源:ruleService.py

示例11: __broadcast_message__rule_updated

# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_error [as 别名]
    def __broadcast_message__rule_updated(self, ruleId):
        try:
            rule = self.__ruleController.get_summary(ruleId)
        except Exception as e:
            Logger.log_error("RuleService.__broadcast_message__rule_updated get_summary ex:", e)
            return

        eventTag = AppConstants.EVENT_RULE_UPDATED
        eventData = rule
        
        self.__broadcast_message(eventTag, eventData)
        Logger.log_info("Rule Updated:", rule["ruleName"])
开发者ID:TheStackBox,项目名称:xuansdk,代码行数:14,代码来源:ruleService.py

示例12: __broadcast_message__scene_updated

# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_error [as 别名]
    def __broadcast_message__scene_updated(self, sceneId):
        try:
            scene = self.__sceneController.get_summary(sceneId)
        except Exception as e:
            Logger.log_error("SceneService.__broadcast_message__scene_updated get_summary ex:", e)
            scene = None
            
        eventTag = AppConstants.EVENT_SCENE_UPDATED
        eventData = {"sceneId":sceneId, "newSceneSummary":scene}

        self.__broadcast_message(eventTag, eventData)
        Logger.log_info("Scene Updated:", scene["sceneName"])
开发者ID:TheStackBox,项目名称:xuansdk,代码行数:14,代码来源:sceneService.py

示例13: __add_scene_execution_result

# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_error [as 别名]
 def __add_scene_execution_result(self, serUrl, serStartTime, serEndTime, sceneName, sceneProtected, sceneId, execution, language):
         try:
             SceneExecutionResultService.instance().add_scene_execution_result(serUrl=serUrl, 
                                                                               serStartTime=serStartTime, 
                                                                               serEndTime=serEndTime, 
                                                                               sceneName=sceneName, 
                                                                               sceneProtected=sceneProtected, 
                                                                               sceneId=sceneId, 
                                                                               execution=execution, 
                                                                               language=language)
         except Exception as e:
             Logger.log_error("SceneService.__add_scene_execution_result ex:", e)
开发者ID:TheStackBox,项目名称:xuansdk,代码行数:14,代码来源:sceneService.py

示例14: __on_shared_method_group_deleted

# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_error [as 别名]
    def __on_shared_method_group_deleted(self, eventObject):
        '''
        Triggered based on event broadcasted by system app.
        '''
        try:
            eventData = json.loads(eventObject["eventData"])
            kbxGroupId = eventData["kbxGroupId"]
            self.delete(kbxGroupId)
        except Exception as e:
            Logger.log_error("GroupController.__on_shared_method_group_deleted ex:", e)
            traceback.print_exc()

            
开发者ID:TheStackBox,项目名称:xuansdk,代码行数:13,代码来源:groupController.py

示例15: __parse_section

# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_error [as 别名]
    def __parse_section(self, section):
        '''
        Convert if/then into correlated automation tags.
        '''
        section = str(section).lower()

        mapDict = {AppConstants.SECTION_CONDITION:AppConstants.TAG_CONDITION,
                   AppConstants.SECTION_EXECUTION:AppConstants.TAG_ACTION}
        
        try:
            return mapDict[section]
        
        except:
            Logger.log_error("__parse_section ex: given value(%s), type(%s), allowed values(%s)" % (str(section), str(type(section)), str(mapDict.keys())))
            raise AutomationException(11097, "section param must be either value from " + str(mapDict.keys())) # invalid parameter
开发者ID:TheStackBox,项目名称:xuansdk,代码行数:17,代码来源:automationModuleWrapper.py


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