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


Python LOGGER.warn方法代码示例

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


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

示例1: gimmeTrame

# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import warn [as 别名]
    def gimmeTrame(self,daNewState):
        """
            Return the update trame to be sent
        """
        if (str(daNewState)=="toggle"):
            if self.current_state=="off":
                #on met à on
                rawTrame="A55A6B0570000000"+ "FF9F1E0"+"7" +"30"
                self.current_state="on"
            elif(self.current_state=="on"):
                #on met à off
                rawTrame="A55A6B0550000000"+ "FF9F1E0"+"7" +"30"
                self.current_state="off"
            else:
                rawTrame="A55A6B0550000000"+ "FF9F1E0"+"7" +"30"
                self.current_state="off"
        else:
            LOGGER.warn("Strange new state : {}. Trram not send".format(daNewState))

            return ""
        LOGGER.info("State after : {}".format(self.current_state))
        myTrame=Trame.trame(rawTrame)
        myTrame.calculateChecksum()
        LOGGER.info("Actuator trame generated, to be send : {}".format(myTrame.lessRawView()))
        self.save()
        return myTrame.rawView()
开发者ID:Minizza,项目名称:ghome,代码行数:28,代码来源:actuator.py

示例2: updateIdentSet

# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import warn [as 别名]
 def updateIdentSet(self):
     """
         Safely update the identifier set of the traductor
     """
     for anUpdate in lazzyUpdate.objects:
         LOGGER.warn("id : {} || state : {}".format(anUpdate.idToUpdate,anUpdate.newState))
         if(anUpdate.idToUpdate==""):
             with self.lock:
                 self.identSet=set([])
                 for lsensor in sensor.Sensor.objects:
                     self.identSet.add(lsensor.physic_id)
                     LOGGER.info(lsensor.physic_id)
                 LOGGER.info("Traductor's set of captors updated")
         elif(anUpdate.newState==""):
             with self.lock:
                 if (anUpdate.idToUpdate in things.physic_id for things in sensor.Sensor.objects):
                     self.identSet.add(anUpdate.idToUpdate)
                     LOGGER.info("{} added".format(anUpdate.idToUpdate))
         else:
             #send a trame from a captor with a newState
             LOGGER.error("Sensor to update : {} ||new state : {}".format(anUpdate.idToUpdate,anUpdate.newState))
             self.sendTrame(anUpdate.idToUpdate,anUpdate.newState)
         anUpdate.delete()
         LOGGER.warn(" {} update           GROS delete de : {} || {}".format(lazzyUpdate.objects.count(),anUpdate.idToUpdate,anUpdate.newState))
         return 
     LOGGER.debug("nothing to update")
开发者ID:Minizza,项目名称:ghome,代码行数:28,代码来源:traductor.py

示例3: get_custom_field

# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import warn [as 别名]
 def get_custom_field(self, field_key):
     result = ''
     try:
         result = self.custom_fields[field_key]
     except KeyError:
         LOGGER.warn('Issue %s does not have value for field %s' % (self.key, field_key))
     return result
开发者ID:OleksiiZhmyrov,项目名称:Aurora,代码行数:9,代码来源:jira.py

示例4: format_date

# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import warn [as 别名]
def format_date(date_string):
    result = date_string
    try:
        time_struct = strptime(date_string, "%d/%b/%y")
        result = date.fromtimestamp(mktime(time_struct))
    except (TypeError, ValueError):
        LOGGER.warn('[%s] is not valid date' % date_string)
    return result
开发者ID:OleksiiZhmyrov,项目名称:Aurora,代码行数:10,代码来源:util.py

示例5: retro_browse_points

# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import warn [as 别名]
def retro_browse_points(request):

    selected_team_name = 'allteams'
    selected_sprint_number = 'allsprints'
    selected_sticker_type = 'alltypes'
    count = 15

    teams = Team.objects.all().order_by('name')
    sprints = Sprint.objects.all().order_by('-number')
    types = BoardSticker.TYPE_CHOICES

    stickers = BoardSticker.objects.all().order_by('-creation_date')

    try:
        selected_team_name = request.GET["team"]
        selected_sprint_number = request.GET["sprint"]
        selected_sticker_type = request.GET["type"]
        count = request.GET["count"]
    except KeyError:
        LOGGER.warn('Request with incorrect parameters. Using defaults.')

    if selected_team_name != 'allteams':
        selected_team = Team.objects.get(name=selected_team_name)
        board = RetroBoard.objects.filter(team=selected_team)
        stickers = stickers.filter(retroBoard__in=board)

    if selected_sprint_number != 'allsprints':
        selected_sprint = Sprint.objects.get(number=selected_sprint_number)
        boards = RetroBoard.objects.filter(sprint=selected_sprint)
        stickers = stickers.filter(retroBoard__in=boards)

    if selected_sticker_type != 'alltypes':
        stickers = stickers.filter(type=selected_sticker_type)

    stickers = stickers[:count]

    types_dict = {}
    for item in BoardSticker.TYPE_CHOICES:
        types_dict[item[0]] = item[1]

    for point in stickers:
        point.type_str = types_dict[point.type]

    if selected_sprint_number != 'allsprints':
        selected_sprint_number = int(selected_sprint_number)

    return render_to_response('retro/dpq_retro_action_points.html',
                              RequestContext(request, {'stickers': stickers,
                                                       'teams': teams,
                                                       'sprints': sprints,
                                                       'types': types,
                                                       'selected_team': selected_team_name,
                                                       'selected_sprint': selected_sprint_number,
                                                       'selected_type': selected_sticker_type,
                                                       'count': int(count),
                                                       'count_options': [15, 30, 45, 60],
                                                       'active_branches': get_active_branches()}))
开发者ID:OleksiiZhmyrov,项目名称:dpq,代码行数:59,代码来源:views.py

示例6: gimmeTrame

# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import warn [as 别名]
 def gimmeTrame(self,daNewState):
     """
         Return the update trame to be sent
     """
     if daNewState=="close":
         data="00000009"
     elif daNewState=="open":
         data="00000008"
     else :
         LOGGER.warn("Strange state : {}. Trame not sent".format(daNewState))
         return ""
     strTrame=elf.trameStart+data+self.physic_id+self.trameEnd
     myTrame=Trame.trame(strTrame)
     myTrame.calculateChecksum()
     LOGGER.debug("Trame returned : {}".format(myTrame.rawView()))
     return myTrame.rawView()
开发者ID:Minizza,项目名称:ghome,代码行数:18,代码来源:switch.py

示例7: translateTrame

# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import warn [as 别名]
 def translateTrame(self,inTrame):
     """
     return  close if data0=09, 
             open if data0=08 
             else nothing
     """
     if (inTrame.data0=='09'):
                     LOGGER.info("Door sensor {} with state [close]".format(inTrame.ident))
                     dataToRet = "close"
     elif(inTrame.data0=='08'):
         LOGGER.info("Door sensor {} with state [open]".format(inTrame.ident))
         dataToRet = "open"
     else:
         LOGGER.warn("Door sensor {}Strange state : {}".format(inTrame.ident, inTrame.data2))
         dataToRet=''
     return dataToRet
开发者ID:Minizza,项目名称:ghome,代码行数:18,代码来源:switch.py

示例8: checkTrame

# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import warn [as 别名]
    def checkTrame(self):
        if self.trameUsed:
            LOGGER.debug("Trame received : {}".format(self.trameUsed.lessRawView()))
            if ("A55A" not in self.trameUsed.sep):
                LOGGER.warn("Wrong separator, rejected")

            if (self.doChecksum(self.trameUsed) not in self.trameUsed.checkSum):     
                #Mauvais checkSum
                LOGGER.warn("Wrong checksum, expected : {}, rejected".format(self.doChecksum(self.trameUsed)))

            with self.lock:
                if (self.trameUsed.ident in self.identSet):
                    #Recuperer le capteur en bdd
                    sensorUsed = sensor.Sensor.objects(physic_id=self.trameUsed.ident)[0]
                    newData = '' #la nouvelle data a entrer en base, type dynamique
                    if (sensorUsed.__class__.__name__=="Switch"):
                        newData=sensorUsed.translateTrame(self.trameUsed)
                    elif (sensorUsed.__class__.__name__=="Temperature"):
                        newData = sensorUsed.translateTrame(self.trameUsed)

                    elif (sensorUsed.__class__.__name__=="Position"):
                        newData = sensorUsed.translateTrame(self.trameUsed)
                    else :
                        LOGGER.warn("Other Captor (not handle (YET !) )")
                    # Update de la trame au niveau de la base
                    if newData :
                        sensorUsed.update(newData)
                        LOGGER.info(" Sensor {} ||New data {}".format(sensorUsed.physic_id, sensorUsed.current_state))
            self.trameUsed=''
开发者ID:Minizza,项目名称:ghome,代码行数:31,代码来源:traductor.py

示例9: get_issue

# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import warn [as 别名]
 def get_issue(key):
     try:
         db_record = DbJiraIssues.get(DbJiraIssues.key == key)
         return DatabaseWrapper.__record_to_issue(db_record)
     except DoesNotExist:
         LOGGER.warn('Issue %s does not exist in database' % key)
开发者ID:OleksiiZhmyrov,项目名称:Aurora,代码行数:8,代码来源:database.py


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